Project: duracloud
Issue DURACLOUD-881: Cannot configure or turn off logging of Retrier in ContentStoreImpl
The ContentStoreImpl currently has hardcoded settings for how it logs errors encountered during "retries". Unfortunately, this is not ideal for all use cases of the API. For example, in the Replication Task Suite, we use ContentStoreImpl.getContentProperties() method as a way to tell whether content already exists in DuraCloud. If that content does not exist, we expect to receive a NotFoundException. This lets us perform logic like: "If content exists in DuraCloud, see what checksum DuraCloud reports. If DuraCloud checksum differs from local checksum, re-upload the content." Unfortunately, however, getContentProperties() logs this same warning message to log4j 4 times in a row (1 + 3 retries) if the content does NOT yet exist in DuraCloud: 2014-07-14 16:46:28,336 WARN org.duracloud.client.ContentStoreImpl @ Error attempting to get properties 'ITEM@10673-10.zip' in 'dspace-dev-backup' due to: Response code was 404, expected value was 200. Response body value: null This causes the logs for the Replication Task Suite to actually fill up with unnecessary warnings from the DuraCloud v3.1.1 API. For example, anytime we want to upload NEW content to DuraCloud, we first check if it already exists (which logs that error x 4) before the new content is uploaded. The logged warnings would cause unnecessary worry for anyone looking at the logs -- in reality they are harmless in this scenario, as the content obviously doesn't exist before it is first uploaded. It looks like the WARN message is generated by "doGetContentProperties" here: https://github.com/duracloud/duracloud/blob/master/storeclient/src/main/java/org/duracloud/client/ContentStoreImpl.java#L904 It is then repeated 4 times as a "log.warn" in the default execute() method (which is configured to do 3 retries): https://github.com/duracloud/duracloud/blob/master/storeclient/src/main/java/org/duracloud/client/ContentStoreImpl.java#L216 Ideally, there should be some way to configure the logging in the ContentStoreImpl. I like that this same task is retried 3 times. But in many scenarios, I'd rather it just throw me a final Error if all retries failed, rather than logging the same error message multiple times in a row. If logging cannot be easily configurable, then switching the default execute() method to just do a "log.debug" would be better. That way I can see the underlying error if I turn on debugging, but by default my logs don't get filled with the same errors repeated. NOTE: This was discovered while attempting to upgrade the DSpace Replication Task Suite to use DuraCloud API version 3.1.1 (JARS: storeclient, storeprovider, common). Unfortunately, until logging is cleaned up in some way, it's unlikely I'll release the upgraded Replication Task Suite code.
Story points: 2