[ 
https://issues.apache.org/jira/browse/SLING-9363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ashish Chopra updated SLING-9363:
---------------------------------
    Description: 
In case of recoverable distribution errors, currently the logs are being 
generated twice. AFAICT it has been the case since [0].

While SLING-9030 tried to improve the situation, but at that time it wasn't 
realized that {{DefaultDistributionLog}} impl [1] not only collects the 
log-lines for distribution-log-servlet [2], but also logs them using slf4j 
loggers [3]. This causes duplicate logging to be generated for the location at 
[5].

I propose that [5] be fixed to remove explicit logging on slf4j logger and just 
rely on {{DefaultDistributionLog}} instance.

[0] 
https://github.com/apache/sling-org-apache-sling-distribution-core/commit/aae95faa14a56c5d5b4cc06cd1a331eb1e107a8b#diff-22682477f3d90f687d6e57f6754b9c86R149-R152
[1] 
https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/log/impl/DefaultDistributionLog.java
[2] 
https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/servlet/DistributionAgentLogServlet.java
[3] 
https://github.com/apache/sling-org-apache-sling-distribution-core/blob/481ddec86400c7889899216e2edfc7bda66d1a2e/src/main/java/org/apache/sling/distribution/log/impl/DefaultDistributionLog.java#L103
[5] 
https://github.com/apache/sling-org-apache-sling-distribution-core/blob/481ddec86400c7889899216e2edfc7bda66d1a2e/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java#L148-L152

  was:
[SimpleDistributionAgentQueueProcessor.java|https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java#L83]
 is responsible for processing a queueItem which is then passed on to 
[RemoteDistributionPackageImporter#importPackage()|https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/packaging/impl/importer/RemoteDistributionPackageImporter.java#L59]
 which in turn selects a valid transporter and send the POST request through 
[SimpleHttpDistributionTransport#deliverPackage()|https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/transport/impl/SimpleHttpDistributionTransport.java#L108].
 There can be 2 types of exceptions thrown by this deliverPackage() function. 
One is a 
[RecoverableDistributionException|https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/common/RecoverableDistributionException.java]
 which is a type of DistributionException and another is DistributionException. 
As the name suggests, a RecoverableDistributionException is where the transport 
is tried again. But it seems there is currently no cap on the number of retries.

For example, if the endpoint is not accessible at the moment, the error logs of 
the caller application will be flooded with constant retries of the 
DistributionPackages in queue, until the endpoint comes up and the distribution 
is successful. The reason being, [the verbose logging done 
here|https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java#L151].
 This would lead to sharp increase in disk size of the caller application. 
Perhaps the logging can be less verbose and can be logged at *WARN* level for 
RecoverableDistributionException.

cc - [~ashishc], [~marett]


> SimpleDistributionAgentQueueProcessor performs duplicate logging
> ----------------------------------------------------------------
>
>                 Key: SLING-9363
>                 URL: https://issues.apache.org/jira/browse/SLING-9363
>             Project: Sling
>          Issue Type: Bug
>          Components: Content Distribution
>            Reporter: Ashish Chopra
>            Assignee: Timothee Maret
>            Priority: Major
>             Fix For: Content Distribution Core 0.4.2
>
>
> In case of recoverable distribution errors, currently the logs are being 
> generated twice. AFAICT it has been the case since [0].
> While SLING-9030 tried to improve the situation, but at that time it wasn't 
> realized that {{DefaultDistributionLog}} impl [1] not only collects the 
> log-lines for distribution-log-servlet [2], but also logs them using slf4j 
> loggers [3]. This causes duplicate logging to be generated for the location 
> at [5].
> I propose that [5] be fixed to remove explicit logging on slf4j logger and 
> just rely on {{DefaultDistributionLog}} instance.
> [0] 
> https://github.com/apache/sling-org-apache-sling-distribution-core/commit/aae95faa14a56c5d5b4cc06cd1a331eb1e107a8b#diff-22682477f3d90f687d6e57f6754b9c86R149-R152
> [1] 
> https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/log/impl/DefaultDistributionLog.java
> [2] 
> https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/servlet/DistributionAgentLogServlet.java
> [3] 
> https://github.com/apache/sling-org-apache-sling-distribution-core/blob/481ddec86400c7889899216e2edfc7bda66d1a2e/src/main/java/org/apache/sling/distribution/log/impl/DefaultDistributionLog.java#L103
> [5] 
> https://github.com/apache/sling-org-apache-sling-distribution-core/blob/481ddec86400c7889899216e2edfc7bda66d1a2e/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java#L148-L152



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to