Changeset 1784
- Timestamp:
- 01/08/2007 00:18:50 (5 years ago)
- Location:
- box/chris/general
- Files:
-
- 21 edited
-
bin/bbackupctl/bbackupctl.cpp (modified) (6 diffs)
-
bin/bbackupd/BackupClientContext.cpp (modified) (5 diffs)
-
bin/bbackupd/Win32ServiceFunctions.cpp (modified) (14 diffs)
-
bin/bbackupquery/BackupQueries.cpp (modified) (1 diff)
-
bin/bbstored/BBStoreDHousekeeping.cpp (modified) (6 diffs)
-
bin/bbstored/BackupCommands.cpp (modified) (6 diffs)
-
bin/bbstored/BackupStoreDaemon.cpp (modified) (4 diffs)
-
bin/bbstored/HousekeepStoreAccount.cpp (modified) (4 diffs)
-
lib/backupclient/BackupClientFileAttributes.cpp (modified) (3 diffs)
-
lib/backupclient/BackupClientRestore.cpp (modified) (13 diffs)
-
lib/backupclient/BackupStoreFile.cpp (modified) (2 diffs)
-
lib/common/BoxTime.cpp (modified) (2 diffs)
-
lib/common/DebugPrintf.cpp (modified) (1 diff)
-
lib/common/Logging.h (modified) (2 diffs)
-
lib/raidfile/RaidFileRead.cpp (modified) (8 diffs)
-
lib/server/Daemon.cpp (modified) (2 diffs)
-
lib/server/LocalProcessStream.cpp (modified) (2 diffs)
-
lib/server/SSLLib.cpp (modified) (2 diffs)
-
lib/server/ServerStream.h (modified) (5 diffs)
-
lib/server/Socket.cpp (modified) (3 diffs)
-
lib/server/WinNamedPipeStream.cpp (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupctl/bbackupctl.cpp
r1690 r1784 163 163 164 164 #if defined WIN32 && ! defined NDEBUG 165 syslog(LOG_ERR,"Failed to connect to the command socket");165 BOX_ERROR("Failed to connect to the command socket"); 166 166 #endif 167 167 … … 176 176 if(!getLine.GetLine(configSummary)) 177 177 { 178 #if defined WIN32 && ! defined NDEBUG 179 syslog(LOG_ERR, "Failed to receive configuration summary " 178 BOX_ERROR("Failed to receive configuration summary " 180 179 "from daemon"); 181 #else182 printf("Failed to receive configuration summary from daemon\n");183 #endif184 185 180 return 1; 186 181 } … … 189 184 if(getLine.IsEOF()) 190 185 { 191 #if defined WIN32 && ! defined NDEBUG 192 syslog(LOG_ERR, "Server rejected the connection. " 193 "Are you running bbackupctl as the same user " 194 "as the daemon?"); 195 #else 196 printf("Server rejected the connection. " 197 "Are you running bbackupctl as the same user " 198 "as the daemon?\n"); 199 #endif 200 186 BOX_ERROR("Server rejected the connection. Are you running " 187 "bbackupctl as the same user as the daemon?"); 201 188 return 1; 202 189 } … … 225 212 if(!getLine.GetLine(stateLine) || getLine.IsEOF()) 226 213 { 227 #if defined WIN32 && ! defined NDEBUG 228 syslog(LOG_ERR, "Failed to receive state line from daemon"); 229 #else 230 printf("Failed to receive state line from daemon\n"); 231 #endif 214 BOX_ERROR("Failed to receive state line from daemon"); 232 215 return 1; 233 216 } … … 237 220 if(::sscanf(stateLine.c_str(), "state %d", ¤tState) != 1) 238 221 { 239 printf("State line didn't decode\n");222 BOX_ERROR("Received invalid state line from daemon"); 240 223 return 1; 241 224 } … … 267 250 if(!autoBackup) 268 251 { 269 printf("ERROR: Daemon is not in automatic mode --"270 "sync will never start! \n");252 BOX_ERROR("Daemon is not in automatic mode, " 253 "sync will never start!"); 271 254 return 1; 272 255 } -
box/chris/general/bin/bbackupd/BackupClientContext.cpp
r1659 r1784 10 10 #include "Box.h" 11 11 12 #ifdef HAVE_SYSLOG_H13 #include <syslog.h>14 #endif15 12 #ifdef HAVE_SIGNAL_H 16 13 #include <signal.h> 17 14 #endif 15 18 16 #ifdef HAVE_SYS_TIME_H 19 17 #include <sys/time.h> … … 128 126 129 127 // Log intention 130 ::syslog(LOG_INFO, "Opening connection to server %s...", mHostname.c_str()); 128 BOX_INFO("Opening connection to server '" << 129 mHostname << "'..."); 131 130 132 131 // Connect! … … 148 147 if (!mpExtendedLogFileHandle) 149 148 { 150 ::syslog(LOG_ERR, "Failed to open extended"151 " log file: %s",strerror(errno));149 BOX_ERROR("Failed to open extended log " 150 "file: " << strerror(errno)); 152 151 } 153 152 else … … 195 194 196 195 // Log success 197 ::syslog(LOG_INFO,"Connection made, login successful");196 BOX_INFO("Connection made, login successful"); 198 197 199 198 // Check to see if there is any space available on the server … … 203 202 mStorageLimitExceeded = true; 204 203 // Log 205 ::syslog(LOG_WARNING, "Exceeded storage hard-limit on server -- not uploading changes to files"); 204 BOX_WARNING("Exceeded storage hard-limit on server, " 205 "not uploading changes to files"); 206 206 } 207 207 } -
box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp
r1033 r1784 45 45 memset(buf, 0, sizeof(buf)); 46 46 _snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err); 47 ::syslog(LOG_ERR, "%s",buf);47 BOX_ERROR(buf); 48 48 MessageBox(0, buf, "Error", 49 49 MB_OK | MB_SETFOREGROUND | MB_DEFAULT_DESKTOP_ONLY); … … 192 192 if (emu_stat(pConfigFileName, &st) != 0) 193 193 { 194 syslog(LOG_ERR, "Failed to open configuration file: "195 "%s: %s", pConfigFileName,strerror(errno));194 BOX_ERROR("Failed to open configuration file '" << 195 pConfigFileName << "': " << strerror(errno)); 196 196 return 1; 197 197 } … … 200 200 { 201 201 202 syslog(LOG_ERR, "Failed to open configuration file: "203 "%s: not a file", pConfigFileName);202 BOX_ERROR("Failed to open configuration file '" << 203 pConfigFileName << "': not a file"); 204 204 return 1; 205 205 } … … 210 210 if (!scm) 211 211 { 212 syslog(LOG_ERR, "Failed to open service control manager: "213 "error %d", GetLastError());212 BOX_ERROR("Failed to open service control manager: " << 213 GetErrorMessage(GetLastError())); 214 214 return 1; 215 215 } … … 249 249 case ERROR_SERVICE_EXISTS: 250 250 { 251 ::syslog(LOG_ERR,"Failed to create Box Backup "251 BOX_ERROR("Failed to create Box Backup " 252 252 "service: it already exists"); 253 253 } … … 256 256 case ERROR_SERVICE_MARKED_FOR_DELETE: 257 257 { 258 ::syslog(LOG_ERR,"Failed to create Box Backup "258 BOX_ERROR("Failed to create Box Backup " 259 259 "service: it is waiting to be deleted"); 260 260 } … … 263 263 case ERROR_DUPLICATE_SERVICE_NAME: 264 264 { 265 ::syslog(LOG_ERR,"Failed to create Box Backup "265 BOX_ERROR("Failed to create Box Backup " 266 266 "service: a service with this name " 267 267 "already exists"); … … 271 271 default: 272 272 { 273 ::syslog(LOG_ERR, "Failed to create Box Backup " 274 "service: error %d", err); 273 BOX_ERROR("Failed to create Box Backup " 274 "service: error " << 275 GetErrorMessage(GetLastError())); 275 276 } 276 277 } … … 279 280 } 280 281 281 ::syslog(LOG_INFO,"Created Box Backup service");282 BOX_INFO("Created Box Backup service"); 282 283 283 284 SERVICE_DESCRIPTION desc; … … 287 288 &desc)) 288 289 { 289 ::syslog(LOG_WARNING, "Failed to set description for"290 " Box Backup service: error %d", GetLastError());290 BOX_WARNING("Failed to set description for Box Backup " 291 "service: " << GetErrorMessage(GetLastError())); 291 292 } 292 293 … … 302 303 if (!scm) 303 304 { 304 syslog(LOG_ERR, "Failed to open service control manager: "305 "error %d", GetLastError());305 BOX_ERROR("Failed to open service control manager: " << 306 GetErrorMessage(GetLastError())); 306 307 return 1; 307 308 } … … 318 319 // hello microsoft? anyone home? 319 320 { 320 syslog(LOG_ERR,"Failed to open Box Backup service: "321 BOX_ERROR("Failed to open Box Backup service: " 321 322 "not installed or not found"); 322 323 } 323 324 else 324 325 { 325 syslog(LOG_ERR, "Failed to open Box Backup service: "326 "error %d", err);326 BOX_ERROR("Failed to open Box Backup service: " << 327 GetErrorMessage(err)); 327 328 } 328 329 return 1; … … 335 336 if (err != ERROR_SERVICE_NOT_ACTIVE) 336 337 { 337 syslog(LOG_WARNING, "Failed to stop Box Backup "338 "service: error %d", err);338 BOX_WARNING("Failed to stop Box Backup service: " << 339 GetErrorMessage(err)); 339 340 } 340 341 } … … 346 347 if (deleted) 347 348 { 348 syslog(LOG_INFO,"Box Backup service deleted");349 BOX_INFO("Box Backup service deleted"); 349 350 return 0; 350 351 } 351 352 else if (err == ERROR_SERVICE_MARKED_FOR_DELETE) 352 353 { 353 syslog(LOG_ERR,"Failed to remove Box Backup service: "354 BOX_ERROR("Failed to remove Box Backup service: " 354 355 "it is already being deleted"); 355 356 } 356 357 else 357 358 { 358 syslog(LOG_ERR, "Failed to remove Box Backup service: "359 "error %d", err);359 BOX_ERROR("Failed to remove Box Backup service: " << 360 GetErrorMessage(err)); 360 361 } 361 362 -
box/chris/general/bin/bbackupquery/BackupQueries.cpp
r1639 r1784 2010 2010 opts['r'] /* resume? */); 2011 2011 } 2012 catch (BoxException &e)2013 {2014 ::syslog(LOG_ERR, "Failed to restore: %s", e.what());2015 return;2016 }2017 2012 catch(std::exception &e) 2018 2013 { 2019 ::syslog(LOG_ERR, "Failed to restore: %s",e.what());2014 BOX_ERROR("Failed to restore: " << e.what()); 2020 2015 return; 2021 2016 } 2022 2017 catch(...) 2023 2018 { 2024 ::syslog(LOG_ERR, "Failed to restore: unknown error");2019 BOX_ERROR("Failed to restore: unknown exception"); 2025 2020 return; 2026 2021 } -
box/chris/general/bin/bbstored/BBStoreDHousekeeping.cpp
r1382 r1784 11 11 12 12 #include <stdio.h> 13 14 #ifdef HAVE_SYSLOG_H15 #include <syslog.h>16 #endif17 13 18 14 #include "BackupStoreDaemon.h" … … 83 79 // Store the time 84 80 mLastHousekeepingRun = timeNow; 85 ::syslog(LOG_INFO,"Starting housekeeping");81 BOX_INFO("Starting housekeeping"); 86 82 87 83 // Get the list of accounts … … 113 109 catch(BoxException &e) 114 110 { 115 ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", 116 *i, e.what(), e.GetType(), e.GetSubType()); 111 BOX_ERROR("Housekeeping on account " << 112 BOX_FORMAT_ACCOUNT(*i) << " threw exception, " 113 "aborting run for this account: " << 114 e.what() << " (" << 115 e.GetType() << "/" << e.GetSubType() << ")"); 117 116 } 118 117 catch(std::exception &e) 119 118 { 120 ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", 121 *i, e.what()); 119 BOX_ERROR("Housekeeping on account " << 120 BOX_FORMAT_ACCOUNT(*i) << " threw exception, " 121 "aborting run for this account: " << 122 e.what()); 122 123 } 123 124 catch(...) 124 125 { 125 ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", 126 *i); 126 BOX_ERROR("Housekeeping on account " << 127 BOX_FORMAT_ACCOUNT(*i) << " threw exception, " 128 "aborting run for this account: " 129 "unknown exception"); 127 130 } 128 131 … … 145 148 } 146 149 147 ::syslog(LOG_INFO,"Finished housekeeping");150 BOX_INFO("Finished housekeeping"); 148 151 149 152 // Placed here for accuracy, if StopRun() is true, for example. … … 191 194 if(mInterProcessComms.GetLine(line, false /* no pre-processing */, MaximumWaitTime)) 192 195 { 193 TRACE1(" housekeeping received command '%s' over interprocess comms\n", line.c_str());196 TRACE1("Housekeeping received command '%s' over interprocess comms\n", line.c_str()); 194 197 195 198 int account = 0; … … 213 216 { 214 217 // Yes! -- need to stop now so when it retries to get the lock, it will succeed 215 ::syslog(LOG_INFO, "Housekeeping giving way to connection for account 0x%08x", AccountNum); 218 BOX_INFO("Housekeeping on account " << 219 BOX_FORMAT_ACCOUNT(AccountNum) << 220 "giving way to client connection"); 216 221 return true; 217 222 } -
box/chris/general/bin/bbstored/BackupCommands.cpp
r1333 r1784 9 9 10 10 #include "Box.h" 11 12 #ifdef HAVE_SYSLOG_H13 #include <syslog.h>14 #endif15 11 16 12 #include <set> … … 89 85 // Check given client ID against the ID in the certificate certificate 90 86 // and that the client actually has an account on this machine 91 if(mClientID != rContext.GetClientID() || !rContext.GetClientHasAccount()) 92 { 93 ::syslog(LOG_INFO, "Failed login: Client ID presented was %08X", mClientID); 94 return std::auto_ptr<ProtocolObject>(new BackupProtocolServerError( 95 BackupProtocolServerError::ErrorType, BackupProtocolServerError::Err_BadLogin)); 87 if(mClientID != rContext.GetClientID()) 88 { 89 BOX_WARNING("Failed login from client ID " << 90 BOX_FORMAT_ACCOUNT(mClientID) << 91 ": wrong certificate for this account"); 92 return std::auto_ptr<ProtocolObject>( 93 new BackupProtocolServerError( 94 BackupProtocolServerError::ErrorType, 95 BackupProtocolServerError::Err_BadLogin)); 96 } 97 98 if(!rContext.GetClientHasAccount()) 99 { 100 BOX_WARNING("Failed login from client ID " << 101 BOX_FORMAT_ACCOUNT(mClientID) << 102 ": no such account on this server"); 103 return std::auto_ptr<ProtocolObject>( 104 new BackupProtocolServerError( 105 BackupProtocolServerError::ErrorType, 106 BackupProtocolServerError::Err_BadLogin)); 96 107 } 97 108 … … 102 113 if(!rContext.AttemptToGetWriteLock()) 103 114 { 104 ::syslog(LOG_INFO, "Failed to get write lock (for Client ID %08X)", mClientID); 105 return std::auto_ptr<ProtocolObject>(new BackupProtocolServerError( 106 BackupProtocolServerError::ErrorType, BackupProtocolServerError::Err_CannotLockStoreForWriting)); 115 BOX_WARNING("Failed to get write lock for Client ID " << 116 BOX_FORMAT_ACCOUNT(mClientID)); 117 return std::auto_ptr<ProtocolObject>( 118 new BackupProtocolServerError( 119 BackupProtocolServerError::ErrorType, 120 BackupProtocolServerError::Err_CannotLockStoreForWriting)); 107 121 } 108 122 … … 121 135 122 136 // Log login 123 ::syslog(LOG_INFO, "Login: Client ID %08X, %s", mClientID, ((mFlags & Flags_ReadOnly) != Flags_ReadOnly)?"Read/Write":"Read-only"); 137 BOX_NOTICE("Login from Client ID " << 138 BOX_FORMAT_ACCOUNT(mClientID) << 139 " " << 140 (((mFlags & Flags_ReadOnly) != Flags_ReadOnly) 141 ?"Read/Write":"Read-only")); 124 142 125 143 // Get the usage info for reporting to the client … … 141 159 std::auto_ptr<ProtocolObject> BackupProtocolServerFinished::DoCommand(BackupProtocolServer &rProtocol, BackupContext &rContext) 142 160 { 143 ::syslog(LOG_INFO, "Session finished"); 161 BOX_NOTICE("Session finished for Client ID " << 162 BOX_FORMAT_ACCOUNT(rContext.GetClientID())); 144 163 145 164 // Let the context know about it … … 312 331 if(en == 0) 313 332 { 314 ::syslog(LOG_ERR, "Object %llx in dir %llx for account %x references object %llx which does not exist in dir", 315 mObjectID, mInDirectory, rContext.GetClientID(), id); 316 return std::auto_ptr<ProtocolObject>(new BackupProtocolServerError( 317 BackupProtocolServerError::ErrorType, BackupProtocolServerError::Err_PatchConsistencyError)); 333 BOX_ERROR("Object " << 334 BOX_FORMAT_OBJECTID(mObjectID) << 335 " in dir " << 336 BOX_FORMAT_OBJECTID(mInDirectory) << 337 " for account " << 338 BOX_FORMAT_ACCOUNT(rContext.GetClientID()) << 339 " references object " << 340 BOX_FORMAT_OBJECTID(id) << 341 " which does not exist in dir"); 342 return std::auto_ptr<ProtocolObject>( 343 new BackupProtocolServerError( 344 BackupProtocolServerError::ErrorType, 345 BackupProtocolServerError::Err_PatchConsistencyError)); 318 346 } 319 347 id = en->GetDependsNewer(); 320 } while(en != 0 && id != 0); 348 } 349 while(en != 0 && id != 0); 321 350 322 351 // OK! The last entry in the chain is the full file, the others are patches back from it. -
box/chris/general/bin/bbstored/BackupStoreDaemon.cpp
r1691 r1784 209 209 ::openlog("bbstored/hk", LOG_PID, LOG_LOCAL6); 210 210 // Log that housekeeping started 211 ::syslog(LOG_INFO,"Housekeeping process started");211 BOX_INFO("Housekeeping process started"); 212 212 // Ignore term and hup 213 213 // Parent will handle these and alert the child via the socket, don't want to randomly die … … 282 282 catch(BoxException &e) 283 283 { 284 ::syslog(LOG_ERR, "%s: disconnecting due to "285 "exception %s (%d/%d)", DaemonName(),286 e. what(), e.GetType(), e.GetSubType());284 BOX_ERROR("Error in child process, terminating connection: " << 285 e.what() << " (" << e.GetType() << "/" << 286 e.GetSubType() << ")"); 287 287 } 288 288 catch(std::exception &e) 289 289 { 290 ::syslog(LOG_ERR, "%s: disconnecting due to "291 "exception %s", DaemonName(),e.what());290 BOX_ERROR("Error in child process, terminating connection: " << 291 e.what()); 292 292 } 293 293 catch(...) 294 294 { 295 ::syslog(LOG_ERR, "%s: disconnecting due to "296 "unknown exception" , DaemonName());295 BOX_ERROR("Error in child process, terminating connection: " << 296 "unknown exception"); 297 297 } 298 298 } … … 312 312 313 313 // Log the name 314 ::syslog(LOG_INFO, "Certificate CN: %s", clientCommonName.c_str());314 BOX_INFO("Client certificate CN: " << clientCommonName); 315 315 316 316 // Check it … … 358 358 { 359 359 // Log the amount of data transferred 360 ::syslog(LOG_INFO, "Connection statistics for %s: " 361 "IN=%lld OUT=%lld TOTAL=%lld", commonName, 362 (long long)s.GetBytesRead(), 363 (long long)s.GetBytesWritten(), 364 (long long)s.GetBytesRead() + 365 (long long)s.GetBytesWritten()); 366 } 360 BOX_INFO("Connection statistics for " << commonName << ":" 361 " IN=" << s.GetBytesRead() << 362 " OUT=" << s.GetBytesWritten() << 363 " TOTAL=" << (s.GetBytesRead() + s.GetBytesWritten())); 364 } -
box/chris/general/bin/bbstored/HousekeepStoreAccount.cpp
r1321 r1784 10 10 #include "Box.h" 11 11 12 #include <stdio.h> 13 12 14 #include <map> 13 #include <stdio.h>14 15 15 16 #include "HousekeepStoreAccount.h" … … 138 139 { 139 140 // Log this 140 ::syslog(LOG_ERR, "On housekeeping, sizes in store do not match calculated sizes, correcting"); 141 ::syslog(LOG_ERR, "different (store,calc): acc 0x%08x, used (%lld,%lld), old (%lld,%lld), deleted (%lld,%lld), dirs (%lld,%lld)", 142 mAccountID, 143 (used + mBlocksUsedDelta), mBlocksUsed, (usedOld + mBlocksInOldFilesDelta), mBlocksInOldFiles, 144 (usedDeleted + mBlocksInDeletedFilesDelta), mBlocksInDeletedFiles, usedDirectories, mBlocksInDirectories); 141 BOX_ERROR("Housekeeping on account " << 142 BOX_FORMAT_ACCOUNT(mAccountID) << " found " 143 "and fixed wrong block counts: " 144 "used (" << 145 (used + mBlocksUsedDelta) << "," << 146 mBlocksUsed << "), old (" << 147 (usedOld + mBlocksInOldFilesDelta) << "," << 148 mBlocksInOldFiles << "), deleted (" << 149 (usedDeleted + mBlocksInDeletedFilesDelta) << 150 "," << mBlocksInDeletedFiles << "), dirs (" << 151 usedDirectories << "," << mBlocksInDirectories 152 << ")"); 145 153 } 146 154 … … 174 182 if(mFilesDeleted > 0 || mEmptyDirectoriesDeleted > 0) 175 183 { 176 ::syslog(LOG_INFO, "Account 0x%08x, removed %lld blocks (%lld files, %lld dirs)%s", mAccountID, 0 - (mBlocksUsedDelta + removeASAPBlocksUsedDelta), 177 mFilesDeleted, mEmptyDirectoriesDeleted, 178 deleteInterrupted?" was interrupted":""); 184 BOX_INFO("Housekeeping on account " << 185 BOX_FORMAT_ACCOUNT(mAccountID) << " " 186 "removed " << 187 (0 - (mBlocksUsedDelta + removeASAPBlocksUsedDelta)) << 188 " blocks (" << mFilesDeleted << " files, " << 189 mEmptyDirectoriesDeleted << " dirs)" << 190 (deleteInterrupted?" and was interrupted":"")); 179 191 } 180 192 181 193 // Make sure the delta's won't cause problems if the counts are really wrong, and 182 194 // it wasn't fixed because the store was updated during the scan. 183 if(mBlocksUsedDelta < (0 - info->GetBlocksUsed())) mBlocksUsedDelta = (0 - info->GetBlocksUsed()); 184 if(mBlocksInOldFilesDelta < (0 - info->GetBlocksInOldFiles())) mBlocksInOldFilesDelta = (0 - info->GetBlocksInOldFiles()); 185 if(mBlocksInDeletedFilesDelta < (0 - info->GetBlocksInDeletedFiles())) mBlocksInDeletedFilesDelta =(0 - info->GetBlocksInDeletedFiles()); 186 if(mBlocksInDirectoriesDelta < (0 - info->GetBlocksInDirectories())) mBlocksInDirectoriesDelta = (0 - info->GetBlocksInDirectories()); 195 if(mBlocksUsedDelta < (0 - info->GetBlocksUsed())) 196 { 197 mBlocksUsedDelta = (0 - info->GetBlocksUsed()); 198 } 199 if(mBlocksInOldFilesDelta < (0 - info->GetBlocksInOldFiles())) 200 { 201 mBlocksInOldFilesDelta = (0 - info->GetBlocksInOldFiles()); 202 } 203 if(mBlocksInDeletedFilesDelta < (0 - info->GetBlocksInDeletedFiles())) 204 { 205 mBlocksInDeletedFilesDelta = (0 - info->GetBlocksInDeletedFiles()); 206 } 207 if(mBlocksInDirectoriesDelta < (0 - info->GetBlocksInDirectories())) 208 { 209 mBlocksInDirectoriesDelta = (0 - info->GetBlocksInDirectories()); 210 } 187 211 188 212 // Update the usage counts in the store … … 555 579 if(pentry == 0) 556 580 { 557 ::syslog(LOG_ERR, "acc 0x%08x, object %lld not found in dir %lld, logic error/corruption? Run bbstoreaccounts check <accid> fix", mAccountID, ObjectID, InDirectory); 581 BOX_ERROR("Housekeeping on account " << 582 BOX_FORMAT_ACCOUNT(mAccountID) << " " 583 "found error: object " << 584 BOX_FORMAT_OBJECTID(ObjectID) << " " 585 "not found in dir " << 586 BOX_FORMAT_OBJECTID(InDirectory) << ", " 587 "indicates logic error/corruption? Run " 588 "bbstoreaccounts check <accid> fix"); 558 589 return; 559 590 } -
box/chris/general/lib/backupclient/BackupClientFileAttributes.cpp
r1635 r1784 345 345 if (winTime >= 0x100000000LL || _gmtime64(&winTime) == 0) 346 346 { 347 ::syslog(LOG_ERR, "Invalid Modification Time"348 " caught for file: %s", Filename);347 BOX_ERROR("Invalid Modification Time caught for " 348 "file: '" << Filename << "'"); 349 349 pattr->ModificationTime = 0; 350 350 } … … 356 356 if (winTime > 0x100000000LL || _gmtime64(&winTime) == 0) 357 357 { 358 ::syslog(LOG_ERR, "Invalid Attribute Modification "359 " Time caught for file: %s", Filename);358 BOX_ERROR("Invalid Attribute Modification Time " 359 "caught for file: '" << Filename << "'"); 360 360 pattr->AttrModificationTime = 0; 361 361 } … … 628 628 629 629 #ifdef WIN32 630 ::syslog(LOG_WARNING, 631 "Cannot create symbolic links on Windows: %s", 632 Filename); 630 BOX_WARNING("Cannot create symbolic links on Windows: '" << 631 Filename << "'"); 633 632 #else 634 633 // Make a symlink, first deleting anything in the way -
box/chris/general/lib/backupclient/BackupClientRestore.cpp
r1661 r1784 236 236 catch (BoxException &e) 237 237 { 238 ::syslog(LOG_ERR, "Failed to check existence for %s: %s",239 rLocalDirectoryName .c_str(),e.what());238 BOX_ERROR("Failed to check existence for " << 239 rLocalDirectoryName << ": " << e.what()); 240 240 return Restore_UnknownError; 241 241 } 242 242 catch(std::exception &e) 243 243 { 244 ::syslog(LOG_ERR, "Failed to check existence for %s: %s",245 rLocalDirectoryName .c_str(),e.what());244 BOX_ERROR("Failed to check existence for " << 245 rLocalDirectoryName << ": " << e.what()); 246 246 return Restore_UnknownError; 247 247 } 248 248 catch(...) 249 249 { 250 ::syslog(LOG_ERR, "Failed to check existence for %s: "251 "unknown error", rLocalDirectoryName.c_str());250 BOX_ERROR("Failed to check existence for " << 251 rLocalDirectoryName << ": unknown error"); 252 252 return Restore_UnknownError; 253 253 } … … 264 264 if(::unlink(rLocalDirectoryName.c_str()) != 0) 265 265 { 266 ::syslog(LOG_ERR, "Failed to delete " 267 "file %s: %s", 268 rLocalDirectoryName.c_str(), 266 BOX_ERROR("Failed to delete file " << 267 rLocalDirectoryName << ": " << 269 268 strerror(errno)); 270 269 return Restore_UnknownError; 271 270 } 272 TRACE1("In restore, directory name collision with file %s", rLocalDirectoryName.c_str()); 271 BOX_TRACE("In restore, directory name " 272 "collision with file " << 273 rLocalDirectoryName); 273 274 } 274 275 break; … … 326 327 catch (BoxException &e) 327 328 { 328 ::syslog(LOG_ERR, "Failed to check existence for %s: "329 "%s", parentDirectoryName.c_str(),e.what());329 BOX_ERROR("Failed to check existence for " << 330 parentDirectoryName << ": " << e.what()); 330 331 return Restore_UnknownError; 331 332 } 332 333 catch(std::exception &e) 333 334 { 334 ::syslog(LOG_ERR, "Failed to check existence for %s: "335 "%s", parentDirectoryName.c_str(),e.what());335 BOX_ERROR("Failed to check existence for " << 336 parentDirectoryName << ": " << e.what()); 336 337 return Restore_UnknownError; 337 338 } 338 339 catch(...) 339 340 { 340 ::syslog(LOG_ERR, "Failed to check existence for %s: "341 "unknown error", parentDirectoryName.c_str());341 BOX_ERROR("Failed to check existence for " << 342 parentDirectoryName << ": unknown error"); 342 343 return Restore_UnknownError; 343 344 } … … 350 351 351 352 case ObjectExists_File: 352 fprintf(stderr, "Failed to restore: '%s' " 353 BOX_ERROR("Failed to restore: '" << 354 parentDirectoryName << "' " 353 355 "is a file, but should be a " 354 "directory.\n", 355 parentDirectoryName.c_str()); 356 "directory."); 356 357 return Restore_TargetPathNotFound; 357 358 358 359 case ObjectExists_NoObject: 359 fprintf(stderr, "Failed to restore: " 360 "parent '%s' of target directory " 361 "does not exist.\n", 362 parentDirectoryName.c_str()); 360 BOX_ERROR("Failed to restore: parent '" << 361 parentDirectoryName << "' of target " 362 "directory does not exist."); 363 363 return Restore_TargetPathNotFound; 364 364 365 365 default: 366 fprintf(stderr, "Failed to restore: " 367 "unknown result from " 368 "ObjectExists('%s').\n", 369 parentDirectoryName.c_str()); 366 BOX_ERROR("Failed to restore: unknown " 367 "result from ObjectExists('" << 368 parentDirectoryName << "')"); 370 369 return Restore_UnknownError; 371 370 } … … 376 375 ::mkdir(rLocalDirectoryName.c_str(), S_IRWXU) != 0) 377 376 { 378 ::syslog(LOG_ERR, "Failed to create directory %s: %s",379 rLocalDirectoryName .c_str(),377 BOX_ERROR("Failed to create directory '" << 378 rLocalDirectoryName << "': " << 380 379 strerror(errno)); 381 380 return Restore_UnknownError; … … 387 386 Params.mResumeInfo.Save(Params.mRestoreResumeInfoFilename); 388 387 } 389 catch (BoxException &e)390 {391 ::syslog(LOG_ERR, "Failed to save resume info file %s: %s",392 Params.mRestoreResumeInfoFilename.c_str(), e.what());393 return Restore_UnknownError;394 }395 388 catch(std::exception &e) 396 389 { 397 ::syslog(LOG_ERR, "Failed to save resume info file %s: %s", 398 Params.mRestoreResumeInfoFilename.c_str(), e.what()); 390 BOX_ERROR("Failed to save resume info file '" << 391 Params.mRestoreResumeInfoFilename << "': " << 392 e.what()); 399 393 return Restore_UnknownError; 400 394 } 401 395 catch(...) 402 396 { 403 ::syslog(LOG_ERR, "Failed to save resume info file %s: "404 "unknown error",405 Params.mRestoreResumeInfoFilename.c_str());397 BOX_ERROR("Failed to save resume info file '" << 398 Params.mRestoreResumeInfoFilename << 399 "': unknown error"); 406 400 return Restore_UnknownError; 407 401 } … … 428 422 dirAttr.WriteAttributes(rLocalDirectoryName.c_str(), true); 429 423 } 430 catch (BoxException &e)431 {432 ::syslog(LOG_ERR, "Failed to restore attributes for %s: %s",433 rLocalDirectoryName.c_str(), e.what());434 return Restore_UnknownError;435 }436 424 catch(std::exception &e) 437 425 { 438 ::syslog(LOG_ERR, "Failed to restore attributes for %s: %s",439 rLocalDirectoryName .c_str(),e.what());426 BOX_ERROR("Failed to restore attributes for '" << 427 rLocalDirectoryName << "': " << e.what()); 440 428 return Restore_UnknownError; 441 429 } 442 430 catch(...) 443 431 { 444 ::syslog(LOG_ERR, "Failed to restore attributes for %s: "445 "unknown error", rLocalDirectoryName.c_str());432 BOX_ERROR("Failed to restore attributes for '" << 433 rLocalDirectoryName << "': unknown error"); 446 434 return Restore_UnknownError; 447 435 } … … 465 453 if(::unlink(localFilename.c_str()) == 0) 466 454 { 467 ::syslog(LOG_ERR, "Failed to delete " 468 "file %s: %s", 469 localFilename.c_str(), 455 BOX_ERROR("Failed to delete file '" << 456 localFilename << "': " << 470 457 strerror(errno)); 471 458 return Restore_UnknownError; … … 495 482 } 496 483 } 497 catch (BoxException &e) 498 { 499 ::syslog(LOG_ERR, "Failed to restore " 500 "file %s: %s", 501 localFilename.c_str(), 484 catch(std::exception &e) 485 { 486 BOX_ERROR("Failed to restore file '" << 487 localFilename << "': " << 502 488 e.what()); 503 489 return Restore_UnknownError; 504 490 } 505 catch(std::exception &e)506 {507 ::syslog(LOG_ERR, "Failed to restore "508 "file %s: %s",509 localFilename.c_str(),510 e.what());511 return Restore_UnknownError;512 }513 491 catch(...) 514 492 { 515 ::syslog(LOG_ERR, "Failed to restore "516 "file %s: unknown error",517 localFilename.c_str());493 BOX_ERROR("Failed to restore file '" << 494 localFilename << 495 "': unknown error"); 518 496 return Restore_UnknownError; 519 497 } … … 541 519 existing */); 542 520 } 543 catch (BoxException &e)544 { 545 ::syslog(LOG_ERR,"Failed to determine "546 "whether file exists: %s: %s",547 localFilename .c_str(),521 catch(std::exception &e) 522 { 523 BOX_ERROR("Failed to determine " 524 "whether file exists: '" << 525 localFilename << "': " << 548 526 e.what()); 549 527 return Restore_UnknownError; 550 528 } 551 catch(std::exception &e)552 {553 ::syslog(LOG_ERR, "Failed to determine "554 "whether file exists: %s: %s",555 localFilename.c_str(),556 e.what());557 return Restore_UnknownError;558 }559 529 catch(...) 560 530 { 561 ::syslog(LOG_ERR,"Failed to determine "562 "whether file exists: %s: "563 "unknown error",564 localFilename.c_str());531 BOX_ERROR("Failed to determine " 532 "whether file exists: '" << 533 localFilename << "': " 534 "unknown error"); 565 535 return Restore_UnknownError; 566 536 } … … 578 548 Params.mResumeInfo.Save(Params.mRestoreResumeInfoFilename); 579 549 } 580 catch (BoxException &e)581 {582 ::syslog(LOG_ERR, "Failed to save resume info file %s: %s",583 Params.mRestoreResumeInfoFilename.c_str(), e.what());584 return Restore_UnknownError;585 }586 550 catch(std::exception &e) 587 551 { 588 ::syslog(LOG_ERR, "Failed to save resume info file %s: %s", 589 Params.mRestoreResumeInfoFilename.c_str(), e.what()); 552 BOX_ERROR("Failed to save resume info file '" << 553 Params.mRestoreResumeInfoFilename << 554 "': " << e.what()); 590 555 return Restore_UnknownError; 591 556 } 592 557 catch(...) 593 558 { 594 ::syslog(LOG_ERR, "Failed to save resume info file %s: "595 "unknown error",596 Params.mRestoreResumeInfoFilename.c_str());559 BOX_ERROR("Failed to save resume info file '" << 560 Params.mRestoreResumeInfoFilename << 561 "': unknown error"); 597 562 return Restore_UnknownError; 598 563 } … … 614 579 Params.mRestoreResumeInfoFilename); 615 580 } 616 catch (BoxException &e) 617 { 618 ::syslog(LOG_ERR, "Failed to save resume info file " 619 "%s: %s", 620 Params.mRestoreResumeInfoFilename.c_str(), 581 catch(std::exception &e) 582 { 583 BOX_ERROR("Failed to save resume info file '" << 584 Params.mRestoreResumeInfoFilename << "': " << 621 585 e.what()); 622 586 return Restore_UnknownError; 623 587 } 624 catch(std::exception &e)625 {626 ::syslog(LOG_ERR, "Failed to save resume info file "627 "%s: %s",628 Params.mRestoreResumeInfoFilename.c_str(),629 e.what());630 return Restore_UnknownError;631 }632 588 catch(...) 633 589 { 634 ::syslog(LOG_ERR, "Failed to save resume info file "635 "%s: unknown error",636 Params.mRestoreResumeInfoFilename.c_str());590 BOX_ERROR("Failed to save resume info file '" << 591 Params.mRestoreResumeInfoFilename << 592 "': unknown error"); 637 593 return Restore_UnknownError; 638 594 } … … 682 638 dirAttr.WriteAttributes(rLocalDirectoryName.c_str(), false); 683 639 } 684 catch (BoxException &e)685 {686 ::syslog(LOG_ERR, "Failed to restore attributes for %s: %s",687 rLocalDirectoryName.c_str(), e.what());688 return Restore_UnknownError;689 }690 640 catch(std::exception &e) 691 641 { 692 ::syslog(LOG_ERR, "Failed to restore attributes for %s: %s",693 rLocalDirectoryName .c_str(),e.what());642 BOX_ERROR("Failed to restore attributes for '" << 643 rLocalDirectoryName << "': " << e.what()); 694 644 return Restore_UnknownError; 695 645 } 696 646 catch(...) 697 647 { 698 ::syslog(LOG_ERR, "Failed to restore attributes for %s: "699 "unknown error", rLocalDirectoryName.c_str());648 BOX_ERROR("Failed to restore attributes for '" << 649 rLocalDirectoryName << "': unknown error"); 700 650 return Restore_UnknownError; 701 651 } -
box/chris/general/lib/backupclient/BackupStoreFile.cpp
r1637 r1784 18 18 #include <new> 19 19 #include <string.h> 20 20 21 #ifndef BOX_DISABLE_BACKWARDS_COMPATIBILITY_BACKUPSTOREFILE 21 #ifndef WIN3222 #include <syslog.h>23 #endif24 22 #include <stdio.h> 25 23 #endif … … 759 757 if(!sWarnedAboutBackwardsCompatiblity) 760 758 { 761 ::printf("WARNING: Decoded one or more files using backwards compatibility mode for block index.\n"); 762 ::syslog(LOG_ERR, "WARNING: Decoded one or more files using backwards compatibility mode for block index.\n"); 759 BOX_WARNING("WARNING: Decoded one or more files using backwards compatibility mode for block index."); 763 760 sWarnedAboutBackwardsCompatiblity = true; 764 761 } -
box/chris/general/lib/common/BoxTime.cpp
r1318 r1784 13 13 #include <sys/time.h> 14 14 #endif 15 15 16 #ifdef HAVE_TIME_H 16 17 #include <time.h> 17 18 #endif 18 #ifdef HAVE_SYSLOG_H 19 #include <syslog.h> 20 #endif 19 21 20 #include <errno.h> 22 21 #include <string.h> … … 41 40 if (gettimeofday(&tv, NULL) != 0) 42 41 { 43 ::syslog(LOG_ERR, "gettimeofday() failed (%s),"44 " dropping precision",strerror(errno));42 BOX_ERROR("Failed to gettimeofday(), dropping " 43 "precision: " << strerror(errno)); 45 44 } 46 45 else -
box/chris/general/lib/common/DebugPrintf.cpp
r219 r1784 14 14 #include <stdio.h> 15 15 #include <stdarg.h> 16 17 #ifdef WIN3218 #include "emu.h"19 #else20 #include <syslog.h>21 #endif22 16 23 17 #include "MemLeakFindOn.h" -
box/chris/general/lib/common/Logging.h
r1603 r1784 11 11 #define LOGGING__H 12 12 13 #include <iomanip> 13 14 #include <sstream> 14 15 #include <vector> … … 42 43 #define BOX_TRACE(stuff) BOX_LOG(Log::TRACE, stuff) 43 44 #endif 45 46 #define BOX_FORMAT_ACCOUNT(accno) \ 47 std::hex << \ 48 std::showbase << \ 49 std::internal << \ 50 std::setw(8) << \ 51 std::setfill('0') << \ 52 (accno) 53 54 #define BOX_FORMAT_OBJECTID(objectid) \ 55 std::hex << \ 56 std::showbase << \ 57 (objectid) 44 58 45 59 #undef ERROR -
box/chris/general/lib/raidfile/RaidFileRead.cpp
r1345 r1784 20 20 #ifdef HAVE_SYS_UIO_H 21 21 #include <sys/uio.h> 22 #endif23 24 #ifdef HAVE_SYSLOG_H25 #include <syslog.h>26 22 #endif 27 23 … … 549 545 void RaidFileRead_Raid::AttemptToRecoverFromIOError(bool Stripe1) 550 546 { 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)); 553 549 554 550 // Close offending file … … 862 858 if(errno == EIO) 863 859 { 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"); 866 864 // Attempt to recover 867 865 AttemptToRecoverFromIOError(true /* is stripe 1 */); … … 880 878 if(errno == EIO) 881 879 { 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"); 884 884 // Attempt to recover 885 885 AttemptToRecoverFromIOError(false /* is stripe 2 */); … … 1055 1055 if(existance != RaidFileUtil::AsRaid) 1056 1056 { 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"); 1059 1060 // TODO: Alert recovery daemon 1060 1061 } … … 1131 1132 if(stripe1errno == EIO) 1132 1133 { 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"); 1135 1137 RaidFileRead_Raid::MoveDamagedFileAlertDaemon(SetNumber, Filename, true /* is stripe 1 */); 1136 1138 … … 1147 1149 if(stripe2errno == EIO) 1148 1150 { 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"); 1151 1154 RaidFileRead_Raid::MoveDamagedFileAlertDaemon(SetNumber, Filename, false /* is stripe 2 */); 1152 1155 … … 1170 1173 if(existance == RaidFileUtil::AsRaidWithMissingReadable) 1171 1174 { 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)"); 1174 1179 1175 1180 // Generate the filenames of all the lovely files -
box/chris/general/lib/server/Daemon.cpp
r1741 r1784 19 19 #include <string.h> 20 20 #include <stdarg.h> 21 22 #ifdef HAVE_SYSLOG_H23 #include <syslog.h>24 #endif25 21 26 22 #ifdef WIN32 … … 354 350 if(::setsid() == -1) 355 351 { 356 ::syslog(LOG_ERR, "can't setsid"); 352 BOX_ERROR("Failed to setsid(): " << 353 strerror(errno)); 357 354 THROW_EXCEPTION(ServerException, DaemoniseFailed) 358 355 } -
box/chris/general/lib/server/LocalProcessStream.cpp
r1039 r1784 121 121 if(!CreatePipe(&readFromChild, &writeInChild, &secAttr, 0)) 122 122 { 123 ::syslog(LOG_ERR,"Failed to CreatePipe for child process: "124 "error %d", GetLastError());123 BOX_ERROR("Failed to CreatePipe for child process: " 124 GetErrorMessage(GetLastError())); 125 125 THROW_EXCEPTION(ServerException, SocketPairFailed) 126 126 } … … 156 156 if(!result) 157 157 { 158 ::syslog(LOG_ERR, "Failed to CreateProcess: '%s': "159 " error %d", CommandLine, GetLastError());158 BOX_ERROR("Failed to CreateProcess: '" << CommandLine << 159 "': " << GetErrorMessage(GetLastError())); 160 160 CloseHandle(writeInChild); 161 161 CloseHandle(readFromChild); -
box/chris/general/lib/server/SSLLib.cpp
r217 r1784 14 14 #include <openssl/err.h> 15 15 #include <openssl/rand.h> 16 17 #ifndef WIN3218 #include <syslog.h>19 #endif20 16 21 17 #include "SSLLib.h" … … 74 70 { 75 71 ::ERR_error_string_n(errcode, errname, sizeof(errname)); 76 #ifndef NDEBUG 77 if(SSLLib__TraceErrors) 78 { 79 TRACE2("SSL err during %s: %s\n", ErrorDuringAction, errname); 80 } 81 #endif 82 ::syslog(LOG_ERR, "SSL err during %s: %s", ErrorDuringAction, errname); 72 BOX_ERROR("SSL error during " << ErrorDuringAction << ": " << 73 errname); 83 74 } 84 75 } -
box/chris/general/lib/server/ServerStream.h
r1603 r1784 15 15 16 16 #ifndef WIN32 17 #include <syslog.h>18 17 #include <sys/wait.h> 19 18 #endif … … 74 73 if(childExit) 75 74 { 76 ::syslog(LOG_ERR, "in server child, exception %s (%d/%d) -- terminating child", e.what(), e.GetType(), e.GetSubType()); 75 BOX_ERROR("Error in child process, " 76 "terminating connection: exception " << 77 e.what() << "(" << e.GetType() << 78 "/" << e.GetSubType() << ")"); 77 79 _exit(1); 78 80 } … … 83 85 if(childExit) 84 86 { 85 ::syslog(LOG_ERR, "in server child, exception %s -- terminating child", e.what()); 87 BOX_ERROR("Error in child process, " 88 "terminating connection: exception " << 89 e.what()); 86 90 _exit(1); 87 91 } … … 92 96 if(childExit) 93 97 { 94 ::syslog(LOG_ERR, "in server child, unknown exception -- terminating child"); 98 BOX_ERROR("Error in child process, " 99 "terminating connection: " 100 "unknown exception"); 95 101 _exit(1); 96 102 } … … 267 273 268 274 // Log it 269 ::syslog(LOG_INFO, "%s (handling in child %d)", logMessage.c_str(), pid);275 BOX_WARNING("Error message from child process " << pid << ": " << logMessage); 270 276 } 271 277 else -
box/chris/general/lib/server/Socket.cpp
r456 r1784 18 18 #include <sys/socket.h> 19 19 #include <netdb.h> 20 #include <syslog.h>21 20 #include <netinet/in.h> 22 21 #include <arpa/inet.h> … … 125 124 { 126 125 case AF_UNIX: 127 ::syslog(LOG_INFO,"Incoming connection from local (UNIX socket)");126 BOX_INFO("Incoming connection from local (UNIX socket)"); 128 127 break; 129 128 … … 131 130 { 132 131 sockaddr_in *a = (sockaddr_in*)addr; 133 ::syslog(LOG_INFO, "Incoming connection from %s port %d", inet_ntoa(a->sin_addr), ntohs(a->sin_port)); 132 BOX_INFO("Incoming connection from " << 133 inet_ntoa(a->sin_addr) << " port " << 134 ntohs(a->sin_port)); 134 135 } 135 136 break; 136 137 137 138 default: 138 ::syslog(LOG_INFO,"Incoming connection of unknown type");139 BOX_WARNING("Incoming connection of unknown type"); 139 140 break; 140 141 } -
box/chris/general/lib/server/WinNamedPipeStream.cpp
r1464 r1784 64 64 catch (std::exception &e) 65 65 { 66 ::syslog(LOG_ERR,"Caught exception while destroying "67 "named pipe, ignored .");66 BOX_ERROR("Caught exception while destroying " 67 "named pipe, ignored: " << e.what()); 68 68 } 69 69 } … … 101 101 if (mSocketHandle == INVALID_HANDLE_VALUE) 102 102 { 103 ::syslog(LOG_ERR, "CreateNamedPipeW failed: %s",104 GetErrorMessage(GetLastError()) .c_str());103 BOX_ERROR("Failed to CreateNamedPipeW(" << pName << "): " << 104 GetErrorMessage(GetLastError())); 105 105 THROW_EXCEPTION(ServerException, SocketOpenError) 106 106 } … … 110 110 if (!connected) 111 111 { 112 ::syslog(LOG_ERR, "ConnectNamedPipe failed: %s",113 GetErrorMessage(GetLastError()) .c_str());112 BOX_ERROR("Failed to ConnectNamedPipe(" << pName << "): " << 113 GetErrorMessage(GetLastError())); 114 114 Close(); 115 115 THROW_EXCEPTION(ServerException, SocketOpenError) … … 127 127 if (mReadableEvent == INVALID_HANDLE_VALUE) 128 128 { 129 ::syslog(LOG_ERR, "Failed to create the Readable event: %s",130 GetErrorMessage(GetLastError()) .c_str());129 BOX_ERROR("Failed to create the Readable event: " << 130 GetErrorMessage(GetLastError())); 131 131 Close(); 132 132 THROW_EXCEPTION(CommonException, Internal) … … 145 145 if (err != ERROR_IO_PENDING) 146 146 { 147 ::syslog(LOG_ERR, "Failed to start overlapped read: "148 "%s", GetErrorMessage(err).c_str());147 BOX_ERROR("Failed to start overlapped read: " << 148 GetErrorMessage(err)); 149 149 Close(); 150 150 THROW_EXCEPTION(ConnectionException, … … 184 184 if (err == ERROR_PIPE_BUSY) 185 185 { 186 ::syslog(LOG_ERR, "Failed to connect to backup"187 " daemon:it is busy with another connection");186 BOX_ERROR("Failed to connect to backup daemon: " 187 "it is busy with another connection"); 188 188 } 189 189 else 190 190 { 191 ::syslog(LOG_ERR, "Failed to connect to backup "192 "daemon: %s", GetErrorMessage(err).c_str());191 BOX_ERROR("Failed to connect to backup daemon: " << 192 GetErrorMessage(err)); 193 193 } 194 194 THROW_EXCEPTION(ServerException, SocketOpenError) … … 262 262 if (err == ERROR_BROKEN_PIPE) 263 263 { 264 ::syslog(LOG_ERR, "Control"265 " clientdisconnected");264 BOX_ERROR("Control client " 265 "disconnected"); 266 266 } 267 267 else 268 268 { 269 ::syslog(LOG_ERR, 270 "Failed to wait for " 269 BOX_ERROR("Failed to wait for " 271 270 "ReadFile to complete: " 272 "%s", 273 GetErrorMessage(err).c_str()); 271 << GetErrorMessage(err)); 274 272 } 275 273 … … 327 325 else if (err == ERROR_BROKEN_PIPE) 328 326 { 329 ::syslog(LOG_ERR, 330 "Control client disconnected"); 327 BOX_ERROR("Control client disconnected"); 331 328 mReadClosed = true; 332 329 } 333 330 else 334 331 { 335 ::syslog(LOG_ERR, "Failed to start " 336 "overlapped read: %s", 337 GetErrorMessage(err).c_str()); 332 BOX_ERROR("Failed to start overlapped read: " 333 << GetErrorMessage(err)); 338 334 Close(); 339 335 THROW_EXCEPTION(ConnectionException, … … 388 384 else 389 385 { 390 ::syslog(LOG_ERR, "Failed to read from " 391 "control socket: %s", 392 GetErrorMessage(err).c_str()); 386 BOX_ERROR("Failed to read from control socket: " 387 << GetErrorMessage(err)); 393 388 THROW_EXCEPTION(ConnectionException, 394 389 Conn_SocketReadError) … … 441 436 { 442 437 DWORD err = GetLastError(); 443 ::syslog(LOG_ERR, "Failed to write to control socket: "444 "%s", GetErrorMessage(err).c_str());438 BOX_ERROR("Failed to write to control socket: " << 439 GetErrorMessage(err)); 445 440 Close(); 446 441 … … 475 470 if (mSocketHandle == INVALID_HANDLE_VALUE && mIsConnected) 476 471 { 477 fprintf(stderr, "Inconsistent connected state\n"); 478 ::syslog(LOG_ERR, "Inconsistent connected state"); 472 BOX_ERROR("Named pipe: inconsistent connected state"); 479 473 mIsConnected = false; 480 474 } … … 489 483 if (!CancelIo(mSocketHandle)) 490 484 { 491 ::syslog(LOG_ERR, "Failed to cancel outstanding " 492 "I/O: %s", 493 GetErrorMessage(GetLastError()).c_str()); 485 BOX_ERROR("Failed to cancel outstanding I/O: " << 486 GetErrorMessage(GetLastError())); 494 487 } 495 488 496 489 if (mReadableEvent == INVALID_HANDLE_VALUE) 497 490 { 498 ::syslog(LOG_ERR, "Failed to destroy Readable"499 " event:invalid handle");491 BOX_ERROR("Failed to destroy Readable event: " 492 "invalid handle"); 500 493 } 501 494 else if (!CloseHandle(mReadableEvent)) 502 495 { 503 ::syslog(LOG_ERR, "Failed to destroy Readable " 504 "event: %s", 505 GetErrorMessage(GetLastError()).c_str()); 496 BOX_ERROR("Failed to destroy Readable event: " << 497 GetErrorMessage(GetLastError())); 506 498 } 507 499 … … 510 502 if (!FlushFileBuffers(mSocketHandle)) 511 503 { 512 ::syslog(LOG_INFO, "FlushFileBuffers failed: %s",513 GetErrorMessage(GetLastError()) .c_str());504 BOX_ERROR("Failed to FlushFileBuffers: " << 505 GetErrorMessage(GetLastError())); 514 506 } 515 507 … … 519 511 if (err != ERROR_PIPE_NOT_CONNECTED) 520 512 { 521 ::syslog(LOG_ERR, "DisconnectNamedPipe " 522 "failed: %s", 523 GetErrorMessage(err).c_str()); 513 BOX_ERROR("Failed to DisconnectNamedPipe: " << 514 GetErrorMessage(err)); 524 515 } 525 516 } … … 537 528 if (!result) 538 529 { 539 ::syslog(LOG_ERR, "CloseHandle failed: %s",540 GetErrorMessage(GetLastError()) .c_str());530 BOX_ERROR("Failed to CloseHandle: " << 531 GetErrorMessage(GetLastError())); 541 532 THROW_EXCEPTION(ServerException, SocketCloseError) 542 533 } … … 586 577 if (!FlushFileBuffers(mSocketHandle)) 587 578 { 588 ::syslog(LOG_WARNING, "FlushFileBuffers failed: %s",589 GetErrorMessage(GetLastError()) .c_str());579 BOX_ERROR("Failed to FlushFileBuffers: " << 580 GetErrorMessage(GetLastError())); 590 581 } 591 582 }
Note: See TracChangeset
for help on using the changeset viewer.
