From 801150a723aaaba2f53995f1646abb9fabc37df5 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Wed, 28 Jul 2010 18:48:33 +0200 Subject: [PATCH] rgw: Support loglevel settings The gateway now supports changing the verbosity of the logging, this can be achieved by changing the RGW_LOG_LEVEL envirioment parameter. For Apache running systems, this can be done with mod_env: SetEnv RGW_LOG_LEVEL 20 This will change the loglevel to the highest level and produce a lot of usefull output for debugging purposes. For now, all the messages will go to webservers logfile (For Apache: error_log) --- src/rgw/rgw_acl.cc | 16 +++++----- src/rgw/rgw_common.cc | 7 +++-- src/rgw/rgw_common.h | 5 +++ src/rgw/rgw_fs.cc | 12 ++++---- src/rgw/rgw_main.cc | 24 +++++++-------- src/rgw/rgw_op.cc | 72 +++++++++++++++++++++++++++---------------- src/rgw/rgw_rados.cc | 21 +++++++------ src/rgw/rgw_rados.h | 2 +- src/rgw/rgw_rest.cc | 11 +++---- 9 files changed, 100 insertions(+), 70 deletions(-) diff --git a/src/rgw/rgw_acl.cc b/src/rgw/rgw_acl.cc index 65cac5342f526..c743c6879a01e 100644 --- a/src/rgw/rgw_acl.cc +++ b/src/rgw/rgw_acl.cc @@ -101,21 +101,21 @@ void ACLGrant::xml_end(const char *el) { acl_id = (ACLID *)acl_grantee->find_first("ID"); if (acl_id) { id = acl_id->to_str(); - cout << "[" << *acl_grantee << ", " << permission << ", " << id << ", " << "]" << std::endl; + RGW_LOG(15) << "[" << *acl_grantee << ", " << permission << ", " << id << ", " << "]" << endl; } break; case ACL_TYPE_GROUP: acl_uri = (ACLURI *)acl_grantee->find_first("URI"); if (acl_uri) { uri = acl_uri->get_data(); - cout << "[" << *acl_grantee << ", " << permission << ", " << uri << "]" << std::endl; + RGW_LOG(15) << "[" << *acl_grantee << ", " << permission << ", " << uri << "]" << endl; } break; case ACL_TYPE_EMAIL_USER: acl_email = (ACLEmail *)acl_grantee->find_first("EmailAddress"); if (acl_email) { email = acl_email->get_data(); - cout << "[" << *acl_grantee << ", " << permission << ", " << email << "]" << std::endl; + RGW_LOG(15) << "[" << *acl_grantee << ", " << permission << ", " << email << "]" << endl; } break; default: @@ -154,15 +154,15 @@ void RGWAccessControlList::xml_end(const char *el) { } int RGWAccessControlList::get_perm(string& id, int perm_mask) { - cerr << "searching permissions for uid=" << id << " mask=" << perm_mask << std::endl; + RGW_LOG(5) << "Searching permissions for uid=" << id << " mask=" << perm_mask << endl; if (!user_map_initialized) init_user_map(); map::iterator iter = acl_user_map.find(id); if (iter != acl_user_map.end()) { - cerr << "found permission: " << iter->second << std::endl; + RGW_LOG(5) << "Found permission: " << iter->second << endl; return iter->second & perm_mask; } - cerr << "permissions for user not found" << std::endl; + RGW_LOG(5) << "Permissions for user not found" << endl; return 0; } @@ -229,7 +229,7 @@ int RGWAccessControlPolicy::get_perm(string& id, int perm_mask) { } } - cerr << "id=" << id << " owner=" << owner << std::endl; + RGW_LOG(5) << "Getting permissions id=" << id << " owner=" << owner << endl; return perm; } @@ -305,7 +305,7 @@ bool RGWXMLParser::init() { p = XML_ParserCreate(NULL); if (!p) { - cerr << "RGWXMLParser::init(): ERROR allocating memory" << std::endl; + RGW_LOG(10) << "RGWXMLParser::init(): ERROR allocating memory" << endl; return false; } XML_SetElementHandler(p, ::xml_start, ::xml_end); diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 4ea8c9f79626f..83cd533d06c49 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -3,6 +3,9 @@ #include "rgw_common.h" #include "rgw_acl.h" +/* Loglevel of the gateway */ +int rgw_log_level = 0; + int parse_time(const char *time_str, time_t *time) { struct tm tm; @@ -29,7 +32,7 @@ int NameVal::parse() val = str.substr(delim_pos + 1); } - cout << "parsed: name=" << name << " val=" << val << std::endl; + RGW_LOG(10) << "parsed: name=" << name << " val=" << val << endl; return ret; } @@ -115,7 +118,7 @@ static char hex_to_num(char c) bool url_decode(string& src_str, string& dest_str) { - cerr << "in url_decode with " << src_str << std::endl; + RGW_LOG(10) << "in url_decode with " << src_str << endl; const char *src = src_str.c_str(); char dest[src_str.size()]; int pos = 0; diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 1f03602c87c2d..1d678f51c6897 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -38,6 +38,9 @@ using namespace std; #define RGW_MAX_CHUNK_SIZE (4*1024*1024) +#define RGW_LOG_BEGIN "RADOS S3 Gateway:" +#define RGW_LOG(x) if ((x) <= rgw_log_level) cout << RGW_LOG_BEGIN << " " + typedef void *RGWAccessHandle; /** Store error returns for output at a different point in the program */ @@ -236,5 +239,7 @@ extern bool verify_permission(struct req_state *s, int perm); * by converting %-escaped strings into characters, etc*/ extern bool url_decode(string& src_str, string& dest_str); +/* loglevel of the gateway */ +extern int rgw_log_level; #endif diff --git a/src/rgw/rgw_fs.cc b/src/rgw/rgw_fs.cc index 6e039f4b163c8..d0b360dfed2ec 100644 --- a/src/rgw/rgw_fs.cc +++ b/src/rgw/rgw_fs.cc @@ -370,7 +370,7 @@ int RGWFS::get_attr(const char *name, const char *path, char **attr) case ERANGE: break; default: - cerr << "getxattr on " << path << " returned" << -errno << std::endl; + RGW_LOG(20) << "getxattr on " << path << " returned" << -errno << endl; return -errno; } len *= 2; @@ -412,7 +412,7 @@ int RGWFS::set_attr(std::string& bucket, std::string& obj, r = setxattr(buf, name, bl.c_str(), bl.length(), 0); int ret = (r < 0 ? -errno : 0); - cerr << "setxattr: path=" << buf << " ret=" << ret << std::endl; + RGW_LOG(20) << "setxattr: path=" << buf << " ret=" << ret << endl; return ret; } @@ -475,7 +475,7 @@ int RGWFS::prepare_get_obj(std::string& bucket, std::string& obj, } if (unmod_ptr) { - if (st.st_mtime >= *mod_ptr) { + if (st.st_mtime >= *unmod_ptr) { err->num = "412"; err->code = "PreconditionFailed"; goto done_err; @@ -488,7 +488,7 @@ int RGWFS::prepare_get_obj(std::string& bucket, std::string& obj, r = -ECANCELED; if (if_match) { - cerr << "etag=" << etag << " " << " if_match=" << if_match << endl; + RGW_LOG(10) << "ETag: " << etag << " " << " If-Match: " << if_match << endl; if (strcmp(if_match, etag)) { err->num = "412"; err->code = "PreconditionFailed"; @@ -497,7 +497,7 @@ int RGWFS::prepare_get_obj(std::string& bucket, std::string& obj, } if (if_nomatch) { - cerr << "etag=" << etag << " " << " if_nomatch=" << if_nomatch << endl; + RGW_LOG(10) << "ETag: " << etag << " " << " If_NoMatch: " << if_nomatch << endl; if (strcmp(if_nomatch, etag) == 0) { err->num = "412"; err->code = "PreconditionFailed"; @@ -540,7 +540,7 @@ int RGWFS::get_obj(void **handle, std::string& bucket, std::string& obj, pos += r; } else { if (!r) { - cerr << "pos=" << pos << " r=" << r << " len=" << len << endl; + RGW_LOG(20) << "pos=" << pos << " r=" << r << " len=" << len << endl; r = -EIO; /* should not happen as we validated file size earlier */ break; } diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index ca454a5484323..5c7b8a73331f0 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -14,6 +14,7 @@ #include "fcgiapp.h" +#include "rgw_common.h" #include "rgw_access.h" #include "rgw_acl.h" #include "rgw_user.h" @@ -32,15 +33,14 @@ using namespace std; - #define CGI_PRINTF(stream, format, ...) do { \ - fprintf(stderr, format, __VA_ARGS__); \ FCGX_FPrintF(stream, format, __VA_ARGS__); \ } while (0) /* * ?get the canonical amazon-style header for something? */ + static void get_canon_amz_hdr(struct req_state *s, string& dest) { dest = ""; @@ -128,7 +128,7 @@ static void calc_hmac_sha1(const char *key, int key_len, buf_to_hex(result, *len, hex_str); - cerr << "hmac=" << hex_str << std::endl; + RGW_LOG(15) << "hmac=" << hex_str << endl; } /* @@ -173,7 +173,7 @@ static bool verify_signature(struct req_state *s) /* first get the user info */ if (rgw_get_user_info(auth_id, s->user) < 0) { - cerr << "error reading user info, uid=" << auth_id << " can't authenticate" << std::endl; + RGW_LOG(5) << "error reading user info, uid=" << auth_id << " can't authenticate" << endl; return false; } @@ -181,7 +181,7 @@ static bool verify_signature(struct req_state *s) string auth_hdr; get_auth_header(s, auth_hdr, qsr); - cerr << "auth_hdr:" << std::endl << auth_hdr << std::endl; + RGW_LOG(10) << "auth_hdr:" << endl << auth_hdr << endl; const char *key = s->user.secret_key.c_str(); int key_len = strlen(key); @@ -193,13 +193,13 @@ static bool verify_signature(struct req_state *s) char b64[64]; /* 64 is really enough */ int ret = encode_base64(hmac_sha1, len, b64, sizeof(b64)); if (ret < 0) { - cerr << "encode_base64 failed" << std::endl; + RGW_LOG(10) << "encode_base64 failed" << endl; return false; } - cerr << "b64=" << b64 << std::endl; - cerr << "auth_sign=" << auth_sign << std::endl; - cerr << "compare=" << auth_sign.compare(b64) << std::endl; + RGW_LOG(15) << "b64=" << b64 << endl; + RGW_LOG(15) << "auth_sign=" << auth_sign << endl; + RGW_LOG(15) << "compare=" << auth_sign.compare(b64) << endl; return (auth_sign.compare(b64) == 0); } @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) RGWHandler_REST rgwhandler; if (!RGWAccess::init_storage_provider("rados", argc, argv)) { - cerr << "couldn't init storage provider" << std::endl; + cerr << "Couldn't init storage provider (RADOS)" << endl; return 5; //EIO } @@ -258,14 +258,14 @@ int main(int argc, char *argv[]) case -ENOENT: break; default: - cerr << "could not read acls" << " ret=" << ret << std::endl; + RGW_LOG(10) << "could not read acls" << " ret=" << ret << endl; abort_early(&s, -EPERM); continue; } } ret = verify_signature(&s); if (!ret) { - cerr << "signature DOESN'T match" << std::endl; + RGW_LOG(10) << "signature DOESN'T match" << endl; abort_early(&s, -EPERM); continue; } diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index c8e4fbe42ded3..f31c73435fd09 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -35,10 +35,10 @@ static int parse_range(const char *range, off_t& ofs, off_t& end) if (ofs_str.length()) ofs = atoll(ofs_str.c_str()); - if (end_str.length()) + if (end_str.length()) end = atoll(end_str.c_str()); -cout << "parse_range ofs=" << ofs << " end=" << end << std::endl; + RGW_LOG(10) << "parse_range ofs=" << ofs << " end=" << end << endl; if (end < ofs) goto done; @@ -62,7 +62,7 @@ void get_request_metadata(struct req_state *s, map& attrs) string name = iter->first; #define X_AMZ_META "x-amz-meta" if (name.find(X_AMZ_META) == 0) { - cerr << "x>> " << iter->first << ":" << iter->second << std::endl; + RGW_LOG(10) << "x>> " << iter->first << ":" << iter->second << endl; string& val = iter->second; bufferlist bl; bl.append(val.c_str(), val.size() + 1); @@ -92,7 +92,11 @@ int read_acls(RGWAccessControlPolicy *policy, string& bucket, string& object) if (ret >= 0) { bufferlist::iterator iter = bl.begin(); policy->decode(iter); - policy->to_xml(cerr); + if (rgw_log_level >= 15) { + RGW_LOG(15) << "Read AccessControlPolicy" << endl; + policy->to_xml(cerr); + RGW_LOG(15) << endl; + } } } @@ -197,7 +201,7 @@ void RGWListBuckets::execute() if (ret < 0) { /* hmm.. something wrong here.. the user was authenticated, so it should exist, just try to recreate */ - cerr << "WARNING: failed on rgw_get_user_buckets uid=" << s->user.user_id << std::endl; + RGW_LOG(10) << "WARNING: failed on rgw_get_user_buckets uid=" << s->user.user_id << endl; rgw_put_user_buckets(s->user.user_id, buckets); ret = 0; } @@ -261,7 +265,7 @@ void RGWCreateBucket::execute() ret = rgw_put_user_buckets(s->user.user_id, buckets); break; default: - cerr << "rgw_get_user_buckets returned " << ret << std::endl; + RGW_LOG(10) << "rgw_get_user_buckets returned " << ret << endl; break; } } @@ -328,10 +332,10 @@ void RGWPutObj::execute() unsigned char m[MD5_DIGEST_LENGTH]; if (supplied_md5_b64) { - cerr << "supplied_md5_b64=" << supplied_md5_b64 << std::endl; + RGW_LOG(15) << "supplied_md5_b64=" << supplied_md5_b64 << endl; int ret = decode_base64(supplied_md5_b64, strlen(supplied_md5_b64), supplied_md5_bin, sizeof(supplied_md5_bin)); - cerr << "decode_base64 ret=" << ret << std::endl; + RGW_LOG(15) << "decode_base64 ret=" << ret << endl; if (ret != MD5_DIGEST_LENGTH) { err.code = "InvalidDigest"; ret = -EINVAL; @@ -339,7 +343,7 @@ void RGWPutObj::execute() } buf_to_hex((const unsigned char *)supplied_md5_bin, MD5_DIGEST_LENGTH, supplied_md5); - cerr << "supplied_md5=" << supplied_md5 << std::endl; + RGW_LOG(15) << "supplied_md5=" << supplied_md5 << endl; } MD5_Init(&c); @@ -406,7 +410,7 @@ static bool parse_copy_source(const char *src, string& bucket, string& object) url_decode(url_src, dec_src); src = dec_src.c_str(); - cerr << "decoded src=" << src << std::endl; + RGW_LOG(15) << "decoded src=" << src << endl; if (*src == '/') ++src; @@ -544,7 +548,7 @@ static int rebuild_policy(RGWAccessControlPolicy& src, RGWAccessControlPolicy& d RGWUserInfo owner_info; if (rgw_get_user_info(owner->get_id(), owner_info) < 0) { - cerr << "owner info does not exist" << std::endl; + RGW_LOG(10) << "owner info does not exist" << endl; return -EINVAL; } ACLOwner& new_owner = dest.get_owner(); @@ -565,9 +569,9 @@ static int rebuild_policy(RGWAccessControlPolicy& src, RGWAccessControlPolicy& d case ACL_TYPE_EMAIL_USER: { string email = src_grant->get_id(); - cerr << "grant user email=" << email << std::endl; + RGW_LOG(10) << "grant user email=" << email << endl; if (rgw_get_uid_by_email(email, id) < 0) { - cerr << "grant user email not found or other error" << std::endl; + RGW_LOG(10) << "grant user email not found or other error" << endl; break; } } @@ -578,12 +582,12 @@ static int rebuild_policy(RGWAccessControlPolicy& src, RGWAccessControlPolicy& d RGWUserInfo grant_user; if (rgw_get_user_info(id, grant_user) < 0) { - cerr << "grant user does not exist:" << id << std::endl; + RGW_LOG(10) << "grant user does not exist:" << id << endl; } else { ACLPermission& perm = src_grant->get_permission(); new_grant.set_canon(id, grant_user.display_name, perm.get_permissions()); grant_ok = true; - cerr << "new grant: " << new_grant.get_id() << ":" << grant_user.display_name << std::endl; + RGW_LOG(10) << "new grant: " << new_grant.get_id() << ":" << grant_user.display_name << endl; } } break; @@ -594,7 +598,7 @@ static int rebuild_policy(RGWAccessControlPolicy& src, RGWAccessControlPolicy& d group.compare(RGW_URI_AUTH_USERS) == 0) { new_grant = *src_grant; grant_ok = true; - cerr << "new grant: " << new_grant.get_id() << std::endl; + RGW_LOG(10) << "new grant: " << new_grant.get_id() << endl; } } default: @@ -640,7 +644,7 @@ void RGWPutACLs::execute() if (get_params() < 0) goto done; - cerr << "read data=" << data << " len=" << len << std::endl; + RGW_LOG(15) << "read data=" << data << " len=" << len << endl; if (!parser.parse(data, len, 1)) { ret = -EACCES; @@ -651,16 +655,21 @@ void RGWPutACLs::execute() ret = -EINVAL; goto done; } - policy->to_xml(cerr); - cerr << std::endl; + if (rgw_log_level >= 15) { + RGW_LOG(15) << "Old AccessControlPolicy" << endl; + policy->to_xml(cerr); + RGW_LOG(15) << endl; + } ret = rebuild_policy(*policy, new_policy); if (ret < 0) goto done; - cerr << "new_policy: "; - new_policy.to_xml(cerr); - cerr << std::endl; + if (rgw_log_level >= 15) { + RGW_LOG(15) << "New AccessControlPolicy" << endl; + new_policy.to_xml(cerr); + RGW_LOG(15) << endl; + } new_policy.encode(bl); ret = rgwstore->set_attr(s->bucket_str, s->object_str, @@ -678,9 +687,20 @@ void RGWHandler::init_state(struct req_state *s, struct fcgx_state *fcgx) { this->s = s; - char *p; - for (int i=0; (p = fcgx->envp[i]); ++i) { - cerr << p << std::endl; + /* Retrieve the loglevel from the CGI envirioment (if set) */ + const char *cgi_env_level = FCGX_GetParam("RGW_LOG_LEVEL", fcgx->envp); + if (cgi_env_level != NULL) { + int level = atoi(cgi_env_level); + if (level > 0) { + rgw_log_level = level; + } + } + + if (rgw_log_level >= 20) { + char *p; + for (int i=0; (p = fcgx->envp[i]); ++i) { + RGW_LOG(20) << p << endl; + } } s->fcgx = fcgx; s->content_started = false; @@ -701,7 +721,7 @@ int RGWHandler::do_read_permissions(bool only_bucket) int ret = read_acls(s, only_bucket); if (ret < 0) - cerr << "read_permissions on " << s->bucket_str << ":" <object_str << " only_bucket=" << only_bucket << " ret=" << ret << std::endl; + RGW_LOG(10) << "read_permissions on " << s->bucket_str << ":" <object_str << " only_bucket=" << only_bucket << " ret=" << ret << endl; return ret; } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index e443407180728..3de07359c50e3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -347,7 +347,7 @@ int RGWRados::copy_obj(std::string& id, std::string& dest_bucket, std::string& d time_t lastmod; map::iterator iter; - cerr << "copy " << src_bucket << ":" << src_obj << " => " << dest_bucket << ":" << dest_obj << std::endl; + RGW_LOG(5) << "Copy object " << src_bucket << ":" << src_obj << " => " << dest_bucket << ":" << dest_obj << endl; void *handle = NULL; @@ -545,8 +545,10 @@ int RGWRados::prepare_get_obj(std::string& bucket, std::string& oid, if (attrs) { r = rados->getxattrs(state->pool, oid, *attrs); - for (iter = attrs->begin(); iter != attrs->end(); ++iter) { - cerr << "xattr: " << iter->first << std::endl; + if (rgw_log_level >= 20) { + for (iter = attrs->begin(); iter != attrs->end(); ++iter) { + RGW_LOG(20) << "Read xattr: " << iter->first << endl; + } } if (r < 0) goto done_err; @@ -557,7 +559,7 @@ int RGWRados::prepare_get_obj(std::string& bucket, std::string& oid, r = -ECANCELED; if (mod_ptr) { - cout << "mod_ptr: " << *mod_ptr << " ctime: " << ctime << endl; + RGW_LOG(10) << "If-Modified-Since: " << *mod_ptr << " Last-Modified: " << ctime << endl; if (ctime < *mod_ptr) { err->num = "304"; err->code = "NotModified"; @@ -566,7 +568,8 @@ int RGWRados::prepare_get_obj(std::string& bucket, std::string& oid, } if (unmod_ptr) { - if (ctime > *mod_ptr) { + RGW_LOG(10) << "If-UnModified-Since: " << *unmod_ptr << " Last-Modified: " << ctime << endl; + if (ctime > *unmod_ptr) { err->num = "412"; err->code = "PreconditionFailed"; goto done_err; @@ -579,7 +582,7 @@ int RGWRados::prepare_get_obj(std::string& bucket, std::string& oid, r = -ECANCELED; if (if_match) { - cerr << "etag=" << etag << " " << " if_match=" << if_match << endl; + RGW_LOG(10) << "ETag: " << etag.c_str() << " " << " If-Match: " << if_match << endl; if (strcmp(if_match, etag.c_str())) { err->num = "412"; err->code = "PreconditionFailed"; @@ -588,7 +591,7 @@ int RGWRados::prepare_get_obj(std::string& bucket, std::string& oid, } if (if_nomatch) { - cerr << "etag=" << etag << " " << " if_nomatch=" << if_nomatch << endl; + RGW_LOG(10) << "ETag: " << etag.c_str() << " " << " If-NoMatch: " << if_nomatch << endl; if (strcmp(if_nomatch, etag.c_str()) == 0) { err->num = "304"; err->code = "NotModified"; @@ -628,9 +631,9 @@ int RGWRados::get_obj(void **handle, if (len > RGW_MAX_CHUNK_SIZE) len = RGW_MAX_CHUNK_SIZE; - cout << "rados->read ofs=" << ofs << " len=" << len << std::endl; + RGW_LOG(20) << "rados->read ofs=" << ofs << " len=" << len << endl; int r = rados->read(state->pool, oid, ofs, bl, len); - cout << "rados->read r=" << r << std::endl; + RGW_LOG(20) << "rados->read r=" << r << endl; if (r > 0) { *data = (char *)malloc(r); diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 22d331ca4eb7e..9293dc89145a0 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -3,7 +3,7 @@ #include "include/librados.h" #include "rgw_access.h" - +#include "rgw_common.h" class RGWRados : public RGWAccess { diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index b1603544f257b..dc5c9083be830 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -5,7 +5,6 @@ #include "rgw_rest.h" #define CGI_PRINTF(stream, format, ...) do { \ - fprintf(stderr, format, __VA_ARGS__); \ FCGX_FPrintF(stream, format, __VA_ARGS__); \ } while (0) @@ -455,8 +454,8 @@ void init_entities_from_header(struct req_state *s) int pos; if (s->host) { string h(s->host); - - cerr << "host=" << s->host << std::endl; + + RGW_LOG(10) << "host=" << s->host << endl; pos = h.find("s3."); if (pos > 0) { @@ -559,7 +558,7 @@ static void init_auth_info(struct req_state *s) for (int i=0; (p = s->fcgx->envp[i]); ++i) { #define HTTP_X_AMZ "HTTP_X_AMZ" if (strncmp(p, HTTP_X_AMZ, sizeof(HTTP_X_AMZ) - 1) == 0) { - cerr << "amz>> " << p << std::endl; + RGW_LOG(10) << "amz>> " << p << endl; const char *amz = p+5; /* skip the HTTP_ part */ const char *eq = strchr(amz, '='); if (!eq) /* shouldn't happen! */ @@ -592,7 +591,7 @@ static void init_auth_info(struct req_state *s) } map::iterator iter; for (iter = s->x_amz_map.begin(); iter != s->x_amz_map.end(); ++iter) { - cerr << "x>> " << iter->first << ":" << iter->second << std::endl; + RGW_LOG(10) << "x>> " << iter->first << ":" << iter->second << endl; } } @@ -623,7 +622,7 @@ void RGWHandler_REST::provider_init_state() s->op = OP_UNKNOWN; init_entities_from_header(s); - cerr << "s->object=" << (s->object ? s->object : "") << " s->bucket=" << (s->bucket ? s->bucket : "") << std::endl; + RGW_LOG(10) << "s->object=" << (s->object ? s->object : "") << " s->bucket=" << (s->bucket ? s->bucket : "") << endl; init_auth_info(s); -- 2.39.5