[ 
https://issues.apache.org/jira/browse/UNOMI-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17574276#comment-17574276
 ] 

Kevan Jahanshahi edited comment on UNOMI-630 at 8/2/22 3:16 PM:
----------------------------------------------------------------

A temporary fix have been introduce for this log:
{code:java}
// TODO Temporary solution that should be handle by: 
https://issues.apache.org/jira/browse/UNOMI-630 (Implement a global solution to 
avoid multiple same log pollution.) 
private static final AtomicLong nowDeprecatedLogTimestamp = new AtomicLong();

//...

// TODO Temporary solution that should be handle by: 
https://issues.apache.org/jira/browse/UNOMI-630 (Implement a global solution to 
avoid multiple same log pollution.)
// warn every 6 hours to avoid log pollution
long timeStamp = nowDeprecatedLogTimestamp.get();
long currentTimeStamp = new Date().getTime();
if (timeStamp == 0 || (timeStamp + TimeUnit.HOURS.toMillis(6) < 
currentTimeStamp)) {
    logger.warn("SetPropertyAction with setPropertyValue: 'now' is deprecated, 
" +
            "please use 'setPropertyValueCurrentEventTimestamp' or 
'setPropertyValueCurrentDate' instead of 'setPropertyValue'");
    nowDeprecatedLogTimestamp.set(currentTimeStamp);
} {code}
In the SetPropertyAction.

Please remove once we have a global solution for handling this properly


was (Author: jkevan):
A temporary fix have been introduce for this log:
{code:java}
// TODO Temporary solution that should be handle by: 
https://issues.apache.org/jira/browse/UNOMI-630 (Implement a global solution to 
avoid multiple same log pollution.)
// warn every 6 hours to avoid log pollution
long timeStamp = nowDeprecatedLogTimestamp.get();
long currentTimeStamp = new Date().getTime();
if (timeStamp == 0 || (timeStamp + TimeUnit.HOURS.toMillis(6) < 
currentTimeStamp)) {
    logger.warn("SetPropertyAction with setPropertyValue: 'now' is deprecated, 
" +
            "please use 'setPropertyValueCurrentEventTimestamp' or 
'setPropertyValueCurrentDate' instead of 'setPropertyValue'");
    nowDeprecatedLogTimestamp.set(currentTimeStamp);
} {code}
In the SetPropertyAction.

Please remove once we have a global solution for handling this properly

> Implement a global solution to avoid multiple same log pollution.
> -----------------------------------------------------------------
>
>                 Key: UNOMI-630
>                 URL: https://issues.apache.org/jira/browse/UNOMI-630
>             Project: Apache Unomi
>          Issue Type: Task
>            Reporter: Kevan Jahanshahi
>            Priority: Major
>
> It happen multiple time already where we tried to deprecate stuff and log 
> messages (warn, error, info) like:
>  * no action in rule
>  * empty condition
>  * "now" property deprecated on condition
>  * etc ...
> And the problem with that is that this logs can really be logged a millions 
> time depending on the events receved and rules triggered, always triggering 
> them.
> The best approach would be:
> Study a system to avoid logging the same log x Times on a time period. 
> Because those logs are still interesting for the users/integrators as they 
> can enlighten bad implem or stuff to be migrate/update. 
> See if we can do something at log4j level.
> The main goal are:
>  * light the logs to avoid huge log file that contains millions time same 
> lines
>  * keep the useful information



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to