Open jongpie opened 3 years ago
Hey @jongpie,
as promised, I wanted to share my feedback to the new plugin. Currently we have the issue, that the rules are not working (see #354 ), but a few weeks ago I was able to test it and there it was working.
In general, this feature is amazing and really helps to keep overview of everything and not blowing up the database with tons of logs. Since we are logging user inputs as part of the customer community, we need to keep these logs forever, if there are any discussions with user. But other logs are just interesting for debugging purposes and can be deleted aber some days.
Together with the rest of my team, we brainstormed about setting up the rules:
Currently we don't completly understand all capabilities of this tool. Maybe you can give some insights, of what is possible 😉
Logger.setRetentionDays(30);
Hi @fentes - this is some incredible feedback, thanks so much for brainstorming with your team & sharing everyone thoughts! I have a couple of follow up thoughts & questions for you & your team
LogRetentionRule__mdt
record, and instead of using the child object LogRetentionRuleCondition__mdt
, it could do something similar to the cleverness that @jamessimone has implemented for Apex Rollup, and just use a single WHERE clause field that the code parses. This would let you create a single, deployable custom metadata record with all of the relevant conditions (using SOQL syntax), although there would be some additional effort needed to implement the parsing logicRegarding your other questions, I've added my responses below each question - hopefully this format is readable, but let me know if you have any follow up questions
LogRetentionRule__mdt.ExecutionOrder__c
- the first rule that matches a log entry/log will be usedAFTER_INSERT
for the LogEntry__c
object - in order to work like you're suggesting, the plugin would need to also run for the LogEntryTag__c
object and/or run on AFTER_UPDATE
on the LogEntry__c
objectLogEntry__c
and Log__c
should work. In your screenshot on #354, you are already specifying Log__r.Scenario__c
to use the Log__c
object, so if you want to use a field on LogEntry__c
, you would just specify the condition's field with the API name of the LogEntry__c
field (such as OriginType__c
, etc.)LogRetentionRule__mdt
and LogRetentionRuleCondition__mdt
, but that would make the initial setup even more cumbersome for all of the rules. Let me know what you think of this ideaThanks again for all of your feedback!
Hey @jongpie,
AFTER_UPDATE
could solve some issues. Would that have some bad impact on performance? Not sure whether BEFORE_UPDATE
(in case of Log__c) would do behave the same with less impact (saving update one DML)@fentes thanks for the feedback! I'm going to try to do 3 things:
BEFORE_UPDATE
and/or AFTER_UPDATE
), and try to add support for additional objects like LogEntryTag__c
LogRetentionRuleCondition__mdt
altogether, and instead changing the implementation to use a single field on LogRetentionRule__mdt
to specify SOQL-style filtering syntax (like @jamessimone does for Apex Rollup). This will be a fairly complex change, but I'd like to try to at least create a proof of concept of this idea, as I think this would be a nicer setup.I have a few other releases that I need to finish before I can work on this, but I'll keep you updated on my progress.
And since we're having some great discussions here, I'm re-opening this issue for now - I'll close it again once I've implemented some of the above items.
Originally posted by @fentes in https://github.com/jongpie/NebulaLogger/discussions/207#discussioncomment-1459571