Ignore:
Timestamp:
01/08/2007 00:18:50 (5 years ago)
Author:
chris
Message:

Replace almost all calls to syslog() with logging framework. (merges [1783])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/general/lib/raidfile/RaidFileRead.cpp

    r1345 r1784  
    2020#ifdef HAVE_SYS_UIO_H 
    2121        #include <sys/uio.h> 
    22 #endif 
    23  
    24 #ifdef HAVE_SYSLOG_H 
    25         #include <syslog.h> 
    2622#endif 
    2723 
     
    549545void RaidFileRead_Raid::AttemptToRecoverFromIOError(bool Stripe1) 
    550546{ 
    551         TRACE3("Attempting to recover from I/O error: %d %s, on stripe %d\n", mSetNumber, mFilename.c_str(), Stripe1?1:2); 
    552         ::syslog(LOG_ERR | LOG_LOCAL5, "Attempting to recover from I/O error: %d %s, on stripe %d\n", mSetNumber, mFilename.c_str(), Stripe1?1:2); 
     547        BOX_WARNING("Attempting to recover from I/O error: " << mSetNumber << 
     548                " " << mFilename << ", on stripe " << (Stripe1?1:2)); 
    553549 
    554550        // Close offending file 
     
    862858                        if(errno == EIO) 
    863859                        { 
    864                                 TRACE3("I/O error when seeking in %d %s (to %d), stripe 1\n", mSetNumber, mFilename.c_str(), (int)FilePosition); 
    865                                 ::syslog(LOG_ERR | LOG_LOCAL5, "I/O error when seeking in %d %s (to %d), stripe 1\n", mSetNumber, mFilename.c_str(), (int)FilePosition); 
     860                                BOX_ERROR("I/O error when seeking in " << 
     861                                        mSetNumber << " " << mFilename << 
     862                                        " (to " << FilePosition << "), " << 
     863                                        "stripe 1"); 
    866864                                // Attempt to recover 
    867865                                AttemptToRecoverFromIOError(true /* is stripe 1 */); 
     
    880878                        if(errno == EIO) 
    881879                        { 
    882                                 TRACE3("I/O error when seeking in %d %s (to %d), stripe 2\n", mSetNumber, mFilename.c_str(), (int)FilePosition); 
    883                                 ::syslog(LOG_ERR | LOG_LOCAL5, "I/O error when seeking in %d %s (to %d), stripe 2\n", mSetNumber, mFilename.c_str(), (int)FilePosition); 
     880                                BOX_ERROR("I/O error when seeking in " << 
     881                                        mSetNumber << " " << mFilename << 
     882                                        " (to " << FilePosition << "), " << 
     883                                        "stripe 2"); 
    884884                                // Attempt to recover 
    885885                                AttemptToRecoverFromIOError(false /* is stripe 2 */); 
     
    10551055                if(existance != RaidFileUtil::AsRaid) 
    10561056                { 
    1057                         TRACE2("Opening %d %s in normal mode, but parity file doesn't exist\n", SetNumber, Filename.c_str()); 
    1058                         ::syslog(LOG_ERR | LOG_LOCAL5, "Opening %d %s in normal mode, but parity file doesn't exist\n", SetNumber, Filename.c_str()); 
     1057                        BOX_ERROR("Opening " << SetNumber << " " << 
     1058                                Filename << " in normal mode, but " 
     1059                                "parity file doesn't exist"); 
    10591060                        // TODO: Alert recovery daemon 
    10601061                } 
     
    11311132                        if(stripe1errno == EIO) 
    11321133                        { 
    1133                                 TRACE2("I/O error on opening %d %s stripe 1, trying recovery mode\n", SetNumber, Filename.c_str()); 
    1134                                 ::syslog(LOG_ERR | LOG_LOCAL5, "I/O error on opening %d %s stripe 1, trying recovery mode\n", SetNumber, Filename.c_str()); 
     1134                                BOX_ERROR("I/O error on opening " << 
     1135                                        SetNumber << " " << Filename << 
     1136                                        " stripe 1, trying recovery mode"); 
    11351137                                RaidFileRead_Raid::MoveDamagedFileAlertDaemon(SetNumber, Filename, true /* is stripe 1 */); 
    11361138 
     
    11471149                        if(stripe2errno == EIO) 
    11481150                        { 
    1149                                 TRACE2("I/O error on opening %d %s stripe 2, trying recovery mode\n", SetNumber, Filename.c_str()); 
    1150                                 ::syslog(LOG_ERR | LOG_LOCAL5, "I/O error on opening %d %s stripe 2, trying recovery mode\n", SetNumber, Filename.c_str()); 
     1151                                BOX_ERROR("I/O error on opening " << 
     1152                                        SetNumber << " " << Filename << 
     1153                                        " stripe 2, trying recovery mode"); 
    11511154                                RaidFileRead_Raid::MoveDamagedFileAlertDaemon(SetNumber, Filename, false /* is stripe 2 */); 
    11521155 
     
    11701173        if(existance == RaidFileUtil::AsRaidWithMissingReadable) 
    11711174        { 
    1172                 TRACE3("Attempting to open RAID file %d %s in recovery mode (stripe %d present)\n", SetNumber, Filename.c_str(), (existingFiles & RaidFileUtil::Stripe1Exists)?1:2); 
    1173                 ::syslog(LOG_ERR | LOG_LOCAL5, "Attempting to open RAID file %d %s in recovery mode (stripe %d present)\n", SetNumber, Filename.c_str(), (existingFiles & RaidFileUtil::Stripe1Exists)?1:2); 
     1175                BOX_ERROR("Attempting to open RAID file " << SetNumber << 
     1176                        " " << Filename << " in recovery mode (stripe " << 
     1177                        ((existingFiles & RaidFileUtil::Stripe1Exists)?1:2) << 
     1178                        " present)"); 
    11741179         
    11751180                // Generate the filenames of all the lovely files 
Note: See TracChangeset for help on using the changeset viewer.