RGWOp *op = NULL;
int init_error = 0;
- RGWHandler *handler = rest->get_handler(store, s, &client_io, &init_error);
+ bool should_log = false;
+ RGWRESTMgr *mgr;
+ RGWHandler *handler = rest->get_handler(store, s, &client_io, &mgr, &init_error);
if (init_error != 0) {
abort_early(s, init_error);
goto done;
}
+ should_log = mgr->get_logging();
+
req->log(s, "getting op");
op = handler->get_op(store);
if (!op) {
op->execute();
op->complete();
done:
- rgw_log_op(store, s, (op ? op->name() : "unknown"), olog);
+ if (should_log) {
+ rgw_log_op(store, s, (op ? op->name() : "unknown"), olog);
+ }
int http_ret = s->err.http_ret;
return 0;
}
+static RGWRESTMgr *set_logging(RGWRESTMgr *mgr)
+{
+ mgr->set_logging(true);
+ return mgr;
+}
+
/*
* start up the RADOS connection and then handle HTTP messages as they come in
*/
}
if (apis_map.count("s3") > 0)
- rest.register_default_mgr(new RGWRESTMgr_S3);
+ rest.register_default_mgr(set_logging(new RGWRESTMgr_S3));
if (apis_map.count("swift") > 0) {
do_swift = true;
swift_init(g_ceph_context);
- rest.register_resource(g_conf->rgw_swift_url_prefix, new RGWRESTMgr_SWIFT);
+ rest.register_resource(g_conf->rgw_swift_url_prefix, set_logging(new RGWRESTMgr_SWIFT));
}
if (apis_map.count("swift_auth") > 0)
- rest.register_resource(g_conf->rgw_swift_auth_entry, new RGWRESTMgr_SWIFT_Auth);
+ rest.register_resource(g_conf->rgw_swift_auth_entry, set_logging(new RGWRESTMgr_SWIFT_Auth));
if (apis_map.count("admin") > 0) {
RGWRESTMgr_Admin *admin_resource = new RGWRESTMgr_Admin;
class RGWHandler_ObjStore_S3;
class RGWRESTMgr {
+ bool should_log;
protected:
map<string, RGWRESTMgr *> resource_mgrs;
multimap<size_t, string> resources_by_size;
RGWRESTMgr *default_mgr;
public:
- RGWRESTMgr() : default_mgr(NULL) {}
+ RGWRESTMgr() : should_log(false), default_mgr(NULL) {}
virtual ~RGWRESTMgr();
void register_resource(string resource, RGWRESTMgr *mgr);
virtual RGWRESTMgr *get_resource_mgr(struct req_state *s, const string& uri, string *out_uri);
virtual RGWHandler *get_handler(struct req_state *s) { return NULL; }
virtual void put_handler(RGWHandler *handler) { delete handler; }
+
+ void set_logging(bool _should_log) { should_log = _should_log; }
+ bool get_logging() { return should_log; }
};
class RGWREST {
public:
RGWREST() {}
RGWHandler *get_handler(RGWRados *store, struct req_state *s, RGWClientIO *cio,
- int *init_error);
+ RGWRESTMgr **pmgr, int *init_error);
void put_handler(RGWHandler *handler) {
mgr.put_handler(handler);
}