vy commented on issue #1941:
URL: 
https://github.com/apache/logging-log4j2/issues/1941#issuecomment-1871851816

   
   > 1. You mentioned that I should "refactor the current `STSR#truncate`" 
method into two methods, where I do truncation first and then package 
exclusions. In terms of implementation, what I currently have working is:
   >    
   >    * run package truncation on `srcWriter` into `dstWriter`
   >    * copy the truncation output from `dstWriter` back to `srcWriter`
   >    * run package exclusion on `srcWriter` into `dstWriter`
   > 
   >   Does this sound like the correct sequence of events for the 
implementation?
   
   Yes. Please add necessary branching to avoid the buffer copying if there are 
no package exclusions.
   
   > 2. For the `StackTraceStringResolverTest`, can I define test 
json-templates in json files under `src/test/resources` instead of repeating 
the deeply-nested `asMap(...)` calls?
   
   I would not stop your from doing it, but I like self-contained tests. As can 
be seen in `log4j-core-test`, placing test resources to `src/test/resources` is 
a slippery slope that eventually leads to a waste land of files where it is not 
possible to trace back who uses what for which purpose. Not to mention, it adds 
to the cognitive load while troubleshooting too.
   
   If you insist on using `src/test/resources`, please only place your JSON 
templates there. That is, don't place a Log4j configuration and use that to 
bootstrap a fully-fledged `LoggerContext`. They are expensive, they pollute the 
JVM and obstruct test parallelization. Please only create a 
`JsonTemplateLayout` instance and test its rendering.
   
   > 3. For the `StackTraceStringResolverTest`, can we split the `@Nested` test 
classes into separate files and group them all in a subpackage (eg 
`layout.template.json.resolver.stacktracestring`)? The current test class is 
getting close to 1000 lines with my new tests and the class is starting to look 
like spaghetti code 😸
   
   Okay. Use `stacktrace.string` please, we will need a `stacktrace.object` in 
the future.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to